Answers for "how to divide values in a column by another column"

1

python divide one column by another

df['Result'] = df['Column A']/df['Column B']
Posted by: Guest on November-03-2020
2

divide a column value in pandas dataframe

df = pd.DataFrame({'A':[61.75, 10.25], 'B':[0.62, 0.45]})
print (df)
       A     B
0  61.75  0.62
1  10.25  0.45

df['A'] = df['A'].div(100).round(2)
#same as
#df['A'] = (df['A'] / 100).round(2)
print (df)
      A     B
0  0.62  0.62
1  0.10  0.45
Posted by: Guest on November-25-2021

Code answers related to "how to divide values in a column by another column"

Python Answers by Framework

Browse Popular Code Answers by Language