import pandas as pda = pd.Series([9,8,7,6],index=['a','b','c','d'])
a
a 9
b 8
c 7
d 6
dtype: int64
a.describe()
count 4.000000
mean 7.500000
std 1.290994
min 6.000000
25% 6.750000
50% 7.500000
75% 8.250000
max 9.000000
dtype: float64
type(a.describe())
pandas.core.series.Series
a.describe()['count']
4.0
a.describe()['max']
9.0
b = pd.DataFrame(np.arange(20).reshape(4,5),index=['c','a','d','b'])
b.describe()
0
1
2
3
4
count
4.000000
4.000000
4.000000
4.000000
4.000000
mean
7.500000
8.500000
9.500000
10.500000
11.500000
std
6.454972
6.454972
6.454972
6.454972
6.454972
min
0.000000
1.000000
2.000000
3.000000
4.000000
25%
3.750000
4.750000
5.750000
6.750000
7.750000
50%
7.500000
8.500000
9.500000
10.500000
11.500000
75%
11.250000
12.250000
13.250000
14.250000
15.250000
max
15.000000
16.000000
17.000000
18.000000
19.000000
type(b.describe())
pandas.core.frame.DataFrame
b.describe().ix['max']# 以Series对象返回
D:\PYTHON\anaconda\lib\site-packages\ipykernel_launcher.py:1: DeprecationWarning:
.ix is deprecated. Please use
.loc for label based indexing or
.iloc for positional indexingSee the documentation here:
http://pandas.pydata.org/pandas-docs/stable/indexing.html#ix-indexer-is-deprecated"""Entry point for launching an IPython kernel.0 15.0
1 16.0
2 17.0
3 18.0
4 19.0
Name: max, dtype: float64
数据的累计统计分析
适用于Series 和 DataFrame类型
b = pd.DataFrame(np.arange(20).reshape(4,5),index=['c','a','d','b'])
b
文章目录 global关键字可变类型和不可变类型数据的内存地址单模块(单个py文件)的全局变量示例总结 多模块(多个py文件)的全局变量from x import x导入全局变量示例 import x导入全局变量示例 总结 global关键字 global 的作用范围是模块(.py)级别: 当你在一个模块(文件)中使用 global 声明变量时,这个变量只在该模块的全局命名空