O'Reilly logo

Hands-On Data Analysis with NumPy and pandas by Curtis Miller

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 DataFrames

Series are interesting, primarily because they are used to build pandas DataFrames. We can think of a pandas DataFrame as combining series together to form a tabular object, with rows and columns being the series. We can create DataFrames in a variety of ways and we will be demonstrating some here. We can give a DataFrame an index. We can also manually specify the names of columns by setting the columns argument. Choosing column names follows the same rules as choosing index names.

Let's see some of the ways we can create DataFrames. The first thing we will do is create DataFrames, and we are not going to care too much about their indices. We can create a DataFrame from a NumPy array:

Here, we have a three-dimensional ...

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