On performing division in jupyter notebook, it is printing only the integer part of quotient. How to fix it?

ipython
python

#1

Hello everyone,
I am working on data exploration in my Jupyter notebook. To find a particular fraction, I divided 273 by 1003 by the following command
273/1003
I was expecting some fraction but it printed 0. Can anyone help me to fix it?


#2

Hi Vikas,

I think you are using python 2.7. This is the default behavior for integer divison
Please use the following import on the top of your notebook.

from __future__ import division

It will then show the fraction on division

or

you can make any numerator / denominator as fraction i.e. 273.0