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 :: unique words from pandas 
Python :: jinja len is undefined 
Python :: django round 2 decimal 
Python :: python strip multiple characters 
Python :: python launch file 
Python :: messages django 
Python :: saving to csv without the index 
Python :: django run queryset in terminal 
Python :: suppress warning jupyter notebook 
Python :: filter rows pandas 
Python :: drop index in multiindex pandas 
Python :: django gunicorn static file not found 
Python :: python histogram as a dictionary 
Python :: how to add headings to data in pandas 
Python :: python how to return max num index 
Python :: python change comma to dot 
Python :: python sum comprehension 
Python :: segregate list in even and odd numbers python 
Python :: greeper 
Python :: combine 2 dataframes based on equal values in columns 
Python :: boston dataset sklearn 
Python :: how to make index column as a normal column 
Python :: convert number to time python 
Python :: python how to get directory of script 
Python :: reverse shell python 
Python :: add empty row to pandas dataframe 
Python :: python loop certain number of times 
Python :: array search with regex python 
Python :: scanning 2d array in python 
Python :: random string generator python 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =