+ 2

How to access index or any specific column in pandas using a condition

Marks = { "Science" : [100, 100, 50], "Maths" : [20, 60, 80], "Order" : [1, 2, 3] } Marks_df = pd.DataFrame(marks, index = ["sainath", "Anurag", " Vishnu"] X = marks_df["science"] == 100 It outputs a boolean value Now how do we access the specific column using this condition Let's say I want order and names of those students who scored 100, how do I do it?

2nd Jul 2020, 1:03 PM
Sainath Dora
5 Antworten
+ 2
Sorry man I made a mistake thanks a lot
2nd Jul 2020, 2:07 PM
Sainath Dora
0
However this only works if both maths and science has scores equal of "sainath"
2nd Jul 2020, 2:08 PM
Sainath Dora