Feb-16-2022, 05:21 PM
Like this?
I removed the line assigning df.groupby That was my attempt at adding the new calculated column into the output sheet...
Don't see the error occurring with the code below but there is no column added either.
thanks,
Mel
I removed the line assigning df.groupby That was my attempt at adding the new calculated column into the output sheet...
Don't see the error occurring with the code below but there is no column added either.
thanks,
Mel
import pandas as pd # file locations input_file = "/Users/PYTHON/Exercise/StudentsGrades.csv" output_file = "/Users/PYTHON/Exercise/" df = pd.read_csv(input_file) df.groupby(['parental level of education']).mean() # df['New Column'] = df.groupby df.to_csv(output_file + 'File_w_Extra_Column.csv')