merge or join operations combine data sets by linking rows using one or more keys these operations are central to relational databases the merge function in pandas is the main entry point for using these algorithms on your data let' start with simple examplein [ ]df dataframe({'key'[' '' '' '' '' '' '' ']'data 'range( )}in [ ]df dataframe({'key'[' '' '' ']'data 'range( )}in [ ]df out[ ]data key in [ ]df out[ ]data key this is an example of many-to-one merge situationthe data in df has multiple rows labeled and bwhereas df has only one row for each value in the key column calling merge with these objects we obtainin [ ]pd merge(df df out[ ]data key data note that didn' specify which column to join on if not specifiedmerge uses the overlapping column names as the keys it' good practice to specify explicitlythoughin [ ]pd merge(df df on='key'out[ ]data key data if the column names are different in each objectyou can specify them separatelyin [ ]df dataframe({'lkey'[' '' '' '' '' '' '' ']'data 'range( )} data wranglingcleantransformmergereshape www it-ebooks info