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

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:

主站蜘蛛池模板: 南雄市| 衡阳市| 富蕴县| 伽师县| 兴文县| 蒲江县| 洪湖市| 彰武县| 板桥市| 曲水县| 琼海市| 黑河市| 安达市| 阳春市| 安平县| 中方县| 武邑县| 措美县| 安徽省| 彰化市| 南乐县| 尖扎县| 灌南县| 宜川县| 玉山县| 永州市| 丹凤县| 定兴县| 浙江省| 珲春市| 抚州市| 屯昌县| 栖霞市| 汶上县| 电白县| 钦州市| 莱阳市| 怀宁县| 安庆市| 五原县| 南宫市|