1

When I do a division in Python/Pandas (e.g. 47/100) how do I show the decimal value of the answer, because at the moment it just shows as 0?

Thanks in advance.

Jon Clements
  • 138,671
  • 33
  • 247
  • 280
user7289
  • 32,560
  • 28
  • 71
  • 88

1 Answers1

2

If you're using python2.x, you need to "floatify"1 one of your numbers:

float(47)/100
47.0/100

As python2.x will do integer division if both numbers in the division are integers.

1floatify: Forcing a number to be a float

mgilson
  • 300,191
  • 65
  • 633
  • 696