数据结构Series基本技巧——数据查看/ 重新索引/ 对齐/ 增、删、改数据
数据查看:
s=pd.Series(np.random.rand(20))
s=pd.Series(np.random.rand(20))
print(s.head(10))
0 0.129709
1 0.512601
2 0.314574
3 0.880346
4 0.842414
5 0.644624
6 0.459001
7 0.303956
8 0.895811
9 0.575024
dtype: float64
print(s.tail())
15 0.805485
16 0.198437
17 0.063945
18 0.481985
19 0.509790
dtype: float64
.head()查看头部数据
.tail()查看末尾数据
默认查看五行。
重新索引 reindex:
s=pd.Series(np.random.rand(5),index=['a','b','c','d','e'])
print(s)
a