I'm trying to find the average of each row without taking into account the "unnamed column" which is the year.
Currently I have:
print(df.mean(axis=0))
But this just finds the average WITH the year which obviously is a huge outlier and skews the data.
Below is the dataset I am using:
CodePudding user response:
Try excluding the first column with .loc
:
print(df.iloc[:, 1:].mean(axis=0))
CodePudding user response:
df[[col for col in df.col if 'Unnamed' not in col]].mean(axis=0)