Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #divide #column #pandas #dataframe
ADD COMMENT
Topic
Name
6+3 =