❮ Previous Next ❯

Merging DataFrames using Pandas

A dataframe is a data structure having multiple rows and columns. In a dataframe, we can
assign data in the form of row and column. A dataframe can perform many operations like
merging, joining, concatenating etc.

DataFrames Merging
There is an in-built function in pandas that is merge() function which is used to merge two data frames.

# Python program to merge dataframes using Pandas

#Required Two Modules Imported
import pandas as pd
import numpy as np

#DataFrame Created
df1 = pd.DataFrame({'Regdno': [101, 102, 103, 104],
            'Name': ['Sashi', 'Sanghamitra', 'Sneha', 'Sradha'],
            'Branch': ['CSE', 'IT', 'ETC', 'EEE']})

df2 = pd.DataFrame({'Regdno': [101, 102, 103, 104],
            'Address': ['BBSR', 'CTC', 'Paradeep', 'Kujang'],
            'HostelNo': ['H1', 'H2', 'H3', 'H4']})

#Two DataFrames merged
pd.merge(df1, df2)



❮ Previous Next ❯

Follow Us


Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Email: info@silantechnology.com
      Phone: 0674-2361252
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved