I am trying to solve a simple problem...I have a file called data.csv with the following data:
enroll_code,student_id
10030,55000
10030,55804
10250,55804
10510,55000
What I am trying to do is to load the file, read the contents, and get the count of the number of values for each enroll_code. Without using Pandas, how can this be done? Here's what I have tried so far...
file = open('data.csv')
csv_reader = csv.reader(file)
next(csv_reader)
for key, value in csv_reader.items():
print(key, len([item for item in csv_reader if item]))
csv_reader.items()?