Merging key names are same
pd.merge(df1, df2, on='key')
Merging key names are different
pd.merge(df1, df2, left_on='l_key', right_on='r_key')
Different types of joining
pd.merge(df1, df2, on='key', how='left')
Merging on multiple keys
pd.merge(df1, df2, on=['key1', 'key2'])
Treatment of overlapping columns
pd.merge(df1, df2, on='key', suffixes=('_left', '_right'))
Using row index instead of merging keys
pd.merge(df1, df2, right_index=True, left_index=True)
Avoid use of .join
syntax as it gives exception for overlapping columns
Merging on left dataframe index and right dataframe column
pd.merge(df1, df2, right_index=True, left_on='l_key')
Concate dataframes
Glued vertically
pd.concat([df1, df2, df3], axis=0)
Glued horizontally
pd.concat([df1, df2, df3], axis=1)