dataframe中根据元素的值获取元素所在的坐标

参看文章https://blog.csdn.net/xwd18280820053/article/details/72614734/

df=pd.DataFrame({“Boolcol”:[1,2,3,3,4],“attr”:[22,33,22,44,66]},index=[10,20,30,40,50])
df
Boolcol attr
10 1 22
20 2 33
30 3 22
40 3 44
50 4 66

a=df[(df.Boolcol3)&(df.attr22)].index.tolist()
a
[30]

猜你喜欢

转载自blog.csdn.net/weixin_43055882/article/details/86553968