Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

divide two columns pandas

#If you want to divide column_name1 by column_name2
df['new_column'] = df.column_name1.div(df.column_name2)
Comment

pandas divide multiple columns by one column

df[['B','C']].div(df.A, axis=0) and df.iloc[:,1:].div(df.A, axis=0)
Comment

PREVIOUS NEXT
Code Example
Python :: how to get all links from a website python beautifulsoup 
Python :: django reverse 
Python :: plotly plot size 
Python :: how to generate requirements.txt django 
Python :: how to find if a value is even or odd in python 
Python :: how to create progress bar python 
Python :: how to multiply inputs in python 
Python :: discord.py play mp3 file 
Python :: mean of a column pandas 
Python :: printable characters python 
Python :: get list of all files in folder and subfolders python 
Python :: tqdm notebook 
Python :: drop columns pandas 
Python :: get current week python 
Python :: get distance between 2 multidimentional point in python 
Python :: import excel file to python 
Python :: how to extract month from date in python 
Python :: python print range 
Python :: tkinter start maximized 
Python :: django migrate using db 
Python :: show image jupyter notebook 
Python :: how to unzip files using zipfile module python 
Python :: how to know python bit version 
Python :: get median of column pandas 
Python :: selenium close browser 
Python :: python merge strings in columns 
Python :: input stdin python 
Python :: sort list of dictionaries by key python 
Python :: get desktop location python 
Python :: python Pandas pivot on bin 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =