Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get a column that corresponds to the average of two columns pandas

df['avg'] = df.mean(axis=1)

       Monday  Tuesday  Wednesday        avg
Mike       42      NaN         12  27.000000
Jenna     NaN      NaN         15  15.000000
Jon        21        4          1   8.666667
Comment

getting a column that corresponds to the average of two columns in pandas

df_mean = df[["a", "b"]].mean()
Comment

PREVIOUS NEXT
Code Example
Python :: how to make window pygame 
Python :: time complexity of data structures in python 
Python :: optimize python code 
Python :: detect grayscale image in python opencv 
Python :: get status code python 
Python :: bytes to Image PIL PY 
Python :: "scrapy shell" pass cookies to fetch 
Python :: My flask static first file 
Python :: This code is supposed to display "2 + 2 = 4" on the screen, but there is an error. Find the error in the code and fix it, so that the output is correct. 
Python :: get the largest of 2 strings python 
Python :: remove percentage in python 
Python :: discord api python putting ids in a list 
Python :: how to kill python process started by excel 
Python :: traduce query model 
Python :: generate 50 characters long for django 
Python :: directory corrente python 
Python :: convert code c++ to python online 
Python :: taggablemanager serializer django 
Shell :: classic confinement requires snaps under /snap or symlink from /snap to /var/lib/snapd/snap 
Shell :: restart apache ubuntu 
Shell :: npm change registry 
Shell :: check react version 
Shell :: git name email 
Shell :: nginx.service is not active, cannot reload. 
Shell :: bash hide command output 
Shell :: clear npm logs 
Shell :: conda opencv 
Shell :: pip install flask_restful 
Shell :: install apt-cyg 
Shell :: zoom download ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =