Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

average out all rows pandas

df.mean(axis=0)#average for each column
df.mean(axis=1)#average for each row
Comment

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()
Comment

PREVIOUS NEXT
Code Example
Python :: pygame tutorial 
Python :: python factorial 
Python :: print multiple lines python 
Python :: what is the difference between python 2 and 3 
Python :: remove character(s)from each column in dataframe 
Python :: Python JSON API example 
Python :: checking if a string contains a substring python 
Python :: python invert binary tree 
Python :: python mettre en minuscule 
Python :: two dimensional array python 
Python :: throw error in python 
Python :: python json check if key exists 
Python :: opencv shift image python 
Python :: sort dictionary by value and then key python 
Python :: how to label points in scatter plot in python 
Python :: django serialize foreign key, django serializer foreign key 
Python :: get multiple inputs in python 
Python :: select columns to include in new dataframe in python 
Python :: discord py check if user has permission return message if not 
Python :: django migrate model 
Python :: intellij python 
Python :: django tempalte tag datetime to timestamp 
Python :: colors in scatter plot python 
Python :: python code to replace first value of txt file 
Python :: python time sleep 
Python :: set xlim histogram python 
Python :: python array index range 
Python :: Compute the 2d histogram of x and y. 
Python :: remove space characters from string in python 
Python :: python argparse custom categories 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =