0

enter image description here

i tried by using loop but it didnt get updated to the df

a=df['differnce']  
for row,value in enumerate(a):
    if(value>0):
        value==value
    else:
        value=-value
    print(value)

output came what i wanted but it does not get updated to the df o/p by loop

41.0
6.0
3.0
189.0
2.0
7.0
59.0
171.0
96.0
20.0
45.0
226.0
161.0
120.0
55.0
40.0
62.0
317.0
36.0
5.0
93.0
3.0
880.0
cs95
  • 379,657
  • 97
  • 704
  • 746
tarun
  • 21
  • 1
  • 5
  • Can you please use full stops and line breaks when writing sentences? Thanks. Also, please format your posts properly in future. – cs95 Oct 29 '17 at 07:38
  • Also, use `abs`: `df['difference'] = df['differnce'].abs()` – cs95 Oct 29 '17 at 07:39

0 Answers0