开发者

Get the condition caught in a if with multiple or conditions in pandas (python) [duplicate]

This question already has answers here: Get index when looping through one column of pandas (2 answers) pandas: get the value of the index for a row? (2 answers) Closed 1 hour ago.

I'm iterating the rows of a pandas dataframe. In case the row enters the if, I want to print the index of the condition with which it has entered the if.

if (row['MCN'] == 2) or (row['ERNF'] == 'T') or (row['EAT1'] == 'T6'):
        print("The co开发者_如何学Pythonndition is", index)

Is there any way to get this index?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜