开发者

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

开发者 https://www.devze.com 2022-12-07 17:57 出处:网络
This question already has answers here: Get index when looping through one column of pandas (2 answers)
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

精彩评论

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

关注公众号