一、数据结构Series和Dataframe
1)Series有两个基本结构 index和values。index默认是0,1,2...,可以自己指定索引,也可以用字典的方式创建Sreies
x1 = pd.Series([1,2,3,4])
x2 = pd.Series([1,2,3,4],index = ['a','b','c','d'])
print(x1)
print(x2)
0 1
1 2
2 3
3 4
dtype: int64
a 1
b 2
c 3
d 4
dtype: int64
x3 = pd.Series({'a':1,'b':2,'c':3,'d':4})
x3
a 1
b 2
c 3
d 4
dtype: int64
2)Dataframe结构类似数据库表
包含了行索引和列索引,可以看做是由相同索引的Series组成的字典
data = {'chinese': [66, 95, 93, 90,80],'english': [65, 85, 92, 88, 90],'math': [30, 98, 96, 77, 90]}
d1 = pd.DataFrame(data)
d2 = pd.DataFrame(data,index=['ZhangFei', 'GuanYu''ZhaoYun','HuangZhong','DianWei'],
columns = ['english&#