0
    strain   Standardforce   stress    percentage
1   10.400000   24400.0   2.750646    -20.800000
2   10.400000   24200.0   2.728100    -20.800000
3   10.400000   24100.0   2.716826     23.800000
4   10.400000   23900.0   2.694280     20.800000

to

    strain   Standardforce   stress    percentage
1   10.400000   24400.0     2.750646        20.8
2   10.400000   24200.0     2.728100        20.8
3   10.400000   24100.0     2.716826        23.8
4   10.400000   23900.0     2.694280        20.8
anky
  • 74,114
  • 11
  • 41
  • 70
satyap
  • 1

1 Answers1

0

You can do this way using round function inside abs:

>>> df.percentage = df.percentage.apply(lambda x: abs(round(x, 2)))
>>> df
   strain  Standardforce    stress  percentage
1    10.4        24400.0  2.750646        20.8
2    10.4        24200.0  2.728100        20.8
3    10.4        24100.0  2.716826        23.8
4    10.4        23900.0  2.694280        20.8
Vicrobot
  • 3,795
  • 1
  • 17
  • 31