Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #average #rows
ADD COMMENT
Topic
Name
9+5 =