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
  • 132,101
  • 31
  • 237
  • 267
user7289
  • 29,472
  • 28
  • 67
  • 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
  • 283,004
  • 58
  • 591
  • 667