how to use if statements to read from two columns in Python?

Viewed 178

I have a file called students.csv. There are a couple of columns. I want to use if statements for two columns, the gender and the scores. I want to display the male students who have got the highest scores (in descending order). So, I need to write a script that can read from the csv file and combine these two columns (gender and scores).

I tried to use:

import pandas as pd

data = pd.read_csv('students.csv')

print(data[data["Gender"] == 1])  

Here I gave male students = 1, and female = 0. But, I don't know how to print the male students who have got the highest scores.

3 Answers
Related