Python 获取负值索引(熊猫)
在我的数据集sdf中:Python 获取负值索引(熊猫),python,pandas,dataframe,Python,Pandas,Dataframe,在我的数据集sdf中: sdf.head() Out[65]: Score 0 161 1 238 2 -53 3 83 4 171 有人能告诉我如何获得分数中那些负值的索引吗?与索引一起使用: a = df.index[df['Score'] < 0] print (a) Int64Index([2], dtype='int64') a=df.index[df['Score']
sdf.head()
Out[65]:
Score
0 161
1 238
2 -53
3 83
4 171
有人能告诉我如何获得分数中那些负值的索引吗?与索引一起使用:
a = df.index[df['Score'] < 0]
print (a)
Int64Index([2], dtype='int64')
a=df.index[df['Score']<0]
印刷品(a)
int64索引([2],dtype='int64')
非常感谢!:)