O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a DataFrame using a Python dictionary and pandas Series objects

A Python dictionary can be used to initialize a DataFrame. When using a Python dictionary, pandas will use the keys as the column names and the values for each key as the data in the column:

A common technique of creating a DataFrame is by using a list of pandas Series objects that will be used as the rows:

In this scenario, each Series represents a single measurement for each city at a specific measurement interval.

To name the columns, we could attempt to use the columns ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required