Unit 34Combining Data

Once your data is in a series or frames, you may need to combine the data to prepare for further processing, as some data may be in one frame and some in another. pandas provides functions for merging and concatenating frames—as long as you know whether you want to merge or to concatenate.

Merging

Merging frames is similar to merging database tables: pandas combines rows with identical indexes (or identical values in other designated columns) from the left and right frames. When there is only one match in the right frame for each row in the left frame, that type of merging is called one-to-one. When there is more than one match, that type of merging is called one-to-many. In that case, pandas replicates the rows of the ...

Get Data Science Essentials in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.