上QQ阅读APP看书,第一时间看更新
Statistics with Pandas DataFrames
The Pandas DataFrame has a dozen statistical methods. The following table lists these methods, along with a short description of each:
Using the same data as the previous example, we will demonstrate these statistical methods. The full script is in the ch-03.ipynb
of this book's code bundle:
import quandl # Data from http://www.quandl.com/SIDC/SUNSPOTS_A-Sunspot-Numbers-Annual # PyPi url https://pypi.python.org/pypi/Quandl sunspots = quandl.get("SIDC/SUNSPOTS_A") print("Describe", sunspots.describe(),"\n") print("Non NaN observations", sunspots.count(),"\n") print("MAD", sunspots.mad(),"\n") print("Median", sunspots.median(),"\n") print("Min", sunspots.min(),"\n") print("Max", sunspots.max(),"\n") print("Mode", sunspots.mode(),"\n") print("Standard Deviation", sunspots.std(),"\n") print("Variance", sunspots.var(),"\n") print("Skewness", sunspots.skew(),"\n") print("Kurtosis", sunspots.kurt(),"\n")
The following is the output of the script: