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 :: python replace one character into string 
Python :: python generic 
Python :: python dataframe save 
Python :: django choicefield empty label 
Python :: string upper lower count python 
Python :: R sample() funciton in python 
Python :: pandas change column type 
Python :: how to find a prime number 
Python :: concatenation of array in python 
Python :: np.arrange 
Python :: save image to database using pillow django 
Python :: imagefield django models 
Python :: python get last item in a list 
Python :: word2vec python 
Python :: pandas como quitar comillas simples de una columna 
Python :: django abstractuser 
Python :: eval function in python 
Python :: check if all elements in list are equal 
Python :: readlines 
Python :: install scrapy on pycharm 
Python :: how to kill somene 
Python :: flask run 
Python :: python get total gpu memory 
Python :: how to check a string is empty in python 
Python :: Local to ISO 8601: 
Python :: pytorch squeeze 
Python :: get first element of tuple python 
Python :: read list stored as a string with pandas read csv 
Python :: flask where to put db.create_all 
Python :: remove empty string from list python single line 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =