July 2019
Beginner to intermediate
740 pages
16h 52m
English
To wrap up this section, we will discuss some pandas functions that will aggregate our data into some common formats. The dataframe methods we discussed previously will give us the highest level of customization; however, pandas provides some functions to quickly generate a pivot table and a crosstab in a common format.
In order to generate a pivot table, we must specify what to group on and, optionally, which subset of columns we want to aggregate and/or how to aggregate (average, by default). Let's create a pivot table of averaged OHLC data for Facebook by the volume traded bins:
>>> fb.pivot_table(columns='trading_volume')
Since we passed in the trading_volume column to the columns argument, the distinct values ...
Read now
Unlock full access