A very simple way to think about a DataFrame is as a bunch of Series that share the same index. A DataFrame is a rectangular table of data that contains an ordered collection of columns, each of which can be a different value type (numeric, string, boolean, and so on). A DataFrame has both rows and column indexes. It can be thought of as being a dictionary of Series, all of which share the same index (any row or column).

Let’s create a few DataFrames to learn more about them.

For our DataFrame, we’ll create two labels or indexes:

  • Our index will be for rows r1 to r10.
  • Our columns will be for columns c1 to c10.

In the code below, we’ll use split() to create a list and then use arange() and reshape() together to create a 2-D array (matrix).

Get hands-on with 1400+ tech skills courses.