Skip to content
Advertisement

How to divide two columns element-wise in a pandas dataframe

I have two columns in my pandas dataframe. I’d like to divide column A by column B, value by value, and show it as follows:

JavaScript

The columns:

JavaScript

And the expected result:

JavaScript

How do I do this?

Advertisement

Answer

Just divide the columns:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement