- For
pandas.DataFrame
bothjoin
andmerge
operates on columns and rename common columns using parametersuffix
concat
can operate on columns or rows, depending on parameteraxis
and no renaming is performed.concat
allow defining hierarchy structure by passing in parameterskeys
andnames
- Combine
all
the columns from the two tables. - Common columns are renamed with the paramaters
lsuffix
andrsuffix
DataFrame.join(self,
other,
on=None,
how='left',
lsuffix='', rsuffix='',
sort=False)
Merge
combinesall
the columns from two tables.- Common columns can be renamed by parameter
suffixes
Merge
provide 3 ways to control alignment
on = 'ColumnName'
( Here the given column must be the common column in both tables )left_on = 'ColumnName'
andright_on = 'ColumnName'
( Tables are aligned using different columns )left_index = True
andright_index = True
( Tables are aligned based on their index )
# Starting with DataFrame:
DataFrame.merge(self,
right,
how='inner',
on=None,
left_on=None, right_on=None,
left_index=False, right_index=False,
sort=False,
suffixes=('_x', '_y'),
copy=True,
indicator=False,
validate=None)
# Starting with Pandas:
pandas.merge(left,
right,
how='inner',
on=None,
left_on=None, right_on=None,
left_index=False, right_index=False,
sort=False,
suffixes=('_x', '_y'),
copy=True,
indicator=False,
validate=None)
pandas.concat(objs,
axis=0, # 0 for row and 1 for column
join='outer', join_axes=None,
ignore_index=False,
keys=None,
levels=None,
names=None,
verify_integrity=False,
sort=None,
copy=True)