Answers for "calculate average of columns pandas"

2

average out all rows pandas

df.mean(axis=0)#average for each column
df.mean(axis=1)#average for each row
Posted by: Guest on May-20-2020
10

calculating mean for pandas column

df["columnName"].mean()
Posted by: Guest on December-10-2020
0

pandas new column average of other columns

col = df.loc[: , "salary_1":"salary_3"]
df['salary_mean'] = col.mean(axis=1)
Posted by: Guest on March-26-2021

Code answers related to "calculate average of columns pandas"

Python Answers by Framework

Browse Popular Code Answers by Language