Click here to Skip to main content
15,917,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys I'm new to pandas in python and I am writing a program where I have data from a csv file. I want to write a program that asks for two items from the file shown where the user inputs, then finds that item in the file and outputs the other information about that item. For example, if my csv file has this data
    ID  Gender  Score1  Score2  T1  T2      Grade
0	101	Male	18.25	15.5	94	61.0	PA
1	102	Female	17.75	30.0	79	62.0	PA
2	103	Male	0.00	0.0	    78	15.0	NN
3	104	Male	20.00	25.0	69	65.0	PA
4	105	Male	18.75	30.0	96	51.0	PA


and the input asks for the Id = 101 and T2, I want the output to be male and 61. This is what I have so far.


Can i have some help please?

What I have tried:

import pandas as pd

T2 = str(input('Waiting for input: '))  
studentID = int(float(input('Waiting for input: ')))  

df = pd.read_csv("sample_grades.csv")

print(f"student gender is {student_gender} and assessment score is {assessment_score:.2f}")
Posted
Updated 19-Sep-21 20:13pm

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900