How to Divide Column By a Number in Pandas

Published Dec 6, 2021  ∙  Updated May 2, 2022

How can we divide all values in a column by some number in a DataFrame?

Example scenario

Suppose we’re dealing with a DataFrame df that looks something like this.

   A      B
0  11.11  0.22
1  33.33  0.44

We want to divide every number in column A by 100.

   A       B
0  0.1111  0.22
1  0.3333  0.44

Divide column by a number

We can divide by a number using div().

df['A'] = df['A'].div(100)
df['A'] = (df['A'] / 100) # Same output