July 2019
Beginner to intermediate
740 pages
16h 52m
English
With the Series class, we essentially had columns of a spreadsheet, with the data all being of the same type. The DataFrame class builds upon the Series class; we can think of it as representing the spreadsheet as a whole. It can have many columns, each with its own data type. We can turn either of the NumPy representations we built of the example data into a DataFrame object:
>>> df = pd.DataFrame(array_dict) >>> df
This gives us a dataframe of six series. Note the column before the time column; this is the Index object for the rows. When creating a DataFrame object, pandas aligns all the series to the same index. In this case, it is just the row number, but we could easily use the time column for this, which would enable some ...
Read now
Unlock full access