How it works...

In the first preceding example, the DataFrame df1 is constructed with the following inputs:

  • A list of lists, which is interpreted as a two-dimensional table. Each list represents a row of the table.
  • The index option, which is a list representing the indexes for each row of the table.
  • The column option, which is a list representing the column names of the table.

In the second example, the DataFrame df2 is constructed with the following inputs:

  • A dictionary. Each item of the dictionary corresponds to a column of the table. The keys of the dictionary give the column names.
  • The index option, which is a list representing the indexes of each row of the table.

The data contained in the two tables is essentially the same. However, notice that, since dictionaries are not ordered data structures, the order of the columns in df2 is arbitrary.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset