官术网_书友最值得收藏!

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:

主站蜘蛛池模板: 垣曲县| 汉源县| 曲麻莱县| 海林市| 青龙| 开封县| 盐亭县| 保康县| 张家界市| 昭通市| 昭觉县| 城口县| 庐江县| 广饶县| 鹤壁市| 北流市| 太湖县| 龙江县| 天祝| 大连市| 镇江市| 株洲市| 封丘县| 兴和县| 阿城市| 郓城县| 芜湖县| 云龙县| 壤塘县| 张家川| 渭南市| 赤城县| 都昌县| 滁州市| 利津县| 仙游县| 屏山县| 浪卡子县| 麦盖提县| 应用必备| 大同县|