Book Image

Learning pandas - Second Edition

By : Michael Heydt
Book Image

Learning pandas - Second Edition

By: Michael Heydt

Overview of this book

You will learn how to use pandas to perform data analysis in Python. You will start with an overview of data analysis and iteratively progress from modeling data, to accessing data from remote sources, performing numeric and statistical analysis, through indexing and performing aggregate analysis, and finally to visualizing statistical data and applying pandas to finance. With the knowledge you gain from this book, you will quickly learn pandas and how it can empower you in the exciting world of data manipulation, analysis and science.
Table of Contents (16 chapters)

Merging and joining data

Pandas allows the merging of pandas objects with database-like join operations, using the pd.merge() function and the .merge() method of a DataFrame object. A merge combines the data of two pandas objects by finding matching values in one or more columns or row indexes. It then returns a new object that represents a combination of the data from both, based on relational-database-like join semantics applied to those values.

Merges are useful as they allow us to model a single DataFrame for each type of data (one of the rules of having tidy data), but to be able to relate data in different DataFrame objects using values existing in both sets of data.

Merging data from multiple pandas objects

A practical...