I read a txt file into a dataframe and now trying to iterate over the rows of the pandas dataframe and create a student object for each of the data entries. and eventually, store the student objects in a list "students".
I am a little confused about how to iterate the rows and add students objects to the students list. Can anyone help me creating this list? thank you
students = []
import pandas as pd
data = pd.read_csv('students.txt')
df = pd.DataFrame(data)
print(df)
file output
firstname lastname status gpa
0 Mike Barnes freshman 4.0
1 Jim Nickerson sophomore 3.0
2 Jack Indabox junior 2.5
3 Jane Doe freshman 1.1
4 Jane Miller senior 3.6
5 Mary Scott senior 2.7
6 John Doe senior 1.0
7 Elvis Presley sophomore 1.5
8 Batman Wayne freshman 0.5
9 Jack Pot junior 2.0