pandas之索引和切片3
2018-10-10 本文已影响0人
郭祺迦
对Series进行切片
s12['a':'f']
'''
a 3
s 1
d 9
f 9
dtype: int32
'''
s12[0:5]
'''
a 3
s 1
d 9
f 9
g 5
dtype: int32
'''
s12.loc['a':'d']
'''
a 3
s 1
d 9
dtype: int32
'''
s12.iloc[0:3]
'''
a 3
s 1
d 9
dtype: int32
'''