April 2015
Beginner to intermediate
504 pages
8h 36m
English
pandas provides several classes of statistical operations that can be applied to a Series or DataFrame object. These reductive methods, when applied to a Series, result in a single value. When applied to a DataFrame, an axis can be specified and the method will then be either applied to each column or row and results in a Series.
The average value is calculated using .mean(). The following calculates the average of the prices for AAPL and MSFT:
In [119]: # calc the mean of the values in each column one_mon_hist.mean() Out[119]: MSFT 47.493182 AAPL 112.411364 dtype: float64
pandas has taken each column and independently calculated the mean for each and returned the results as values in a Series that ...
Read now
Unlock full access