July 2019
Beginner to intermediate
740 pages
16h 52m
English
When we discussed window calculations, we saw that we could run the agg() method on the result of rolling(), expanding(), or ewm(); however, we can also call it directly on the dataframe in the same fashion. The only difference is that the aggregations done this way will be performed on all the data, meaning that we will only get a series back that contains the overall result. Let's aggregate the Facebook stock data the same way we did with the window calculations. Note that we won't get anything back for the trading_volume column, which contains the volume traded bins from pd.cut(); this is because we aren't specifying an aggregation to run on that column:
>>> fb.agg({... 'open': np.mean, 'high': np.max, 'low': np.min, ...Read now
Unlock full access