python list作为参数+loc iloc

 python list作为参数

import pandas as pd
import numpy as np
##list作为参数
list = [1, 2, 100, 4]
# print(list)
df = pd.Series(['a', 'b', 'c', 'd'], index=list)  #!!!!!!!!!!!Series 大写
print(df)
print(df.loc[1],df.iloc[1])
1    a
2    b
3    c
4    d
dtype: object
a b
Process finished with exit code 0

猜你喜欢

转载自blog.csdn.net/qq_27866857/article/details/111935360