Answers for "pandas get row with average value in column"

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
0

pandas average every n rows

# credit to the Stack Overflow user in the source link
# df is the pandas DataFrame
n = 25 # the number of rows
df.groupby(np.arange(len(df))//n).mean()
Posted by: Guest on September-15-2021

Code answers related to "pandas get row with average value in column"

Python Answers by Framework

Browse Popular Code Answers by Language