nan many-to-many joins form the cartesian product of the rows since there were 'brows in the left dataframe and in the right onethere are 'brows in the result the join method only affects the distinct key values appearing in the resultin [ ]pd merge(df df how='inner'out[ ]data key data to merge with multiple keyspass list of column namesin [ ]left dataframe({'key '['foo''foo''bar']'key '['one''two''one']'lval'[ ]}in [ ]right dataframe({'key '['foo''foo''bar''bar']'key '['one''one''one''two']'rval'[ ]}in [ ]pd merge(leftrighton=['key ''key ']how='outer'out[ ]key key lval rval bar one bar two nan foo one foo one foo two nan to determine which key combinations will appear in the result depending on the choice of merge methodthink of the multiple keys as forming an array of tuples to be used as single join key (even though it' not actually implemented that waywhen joining columns-on-columnsthe indexes on the passed dataframe objects are discarded data wranglingcleantransformmergereshape www it-ebooks info