索引
import pandas as pd
ser=pd.Series(range(0,10,2))
print(ser)
0 0
1 2
2 4
3 6
4 8
dtype...: int64
通过索引值或索引标签获取数据
通过index查看索引值
print(ser.index)
RangeIndex(start=0, stop=5, step=1)
自定义索引值
ser.index...=['a','b','c','d','f']
print(ser)
a 0
b 2
c 4
d 6
f 8
dtype: int64
通过索引值和索引标签获取数据
print...查询数据
import pandas as pd
stu_dic={
'name':['a','b','c','d','e','f','g','h'],
'age':[18,15,45,56,89,78,45,12...f
4 e 89 f
5 f 78 f
6 g 45 m
7 h 12 m
查询指定的行
student.loc[[1,2,3]]
loc标签索引函数必须是中括号