1

I have imported excel file into python pandas. but when I display customer numbers I get in float64 format i.e

7.500505e+09 , 7.503004e+09 how do convert the column containing these numbers

rahul dbz
  • 75
  • 1
  • 8

3 Answers3

0

int(yourVariable) will cast your float64 to a integer number. Is this what you are looking for?

CBM_89
  • 39
  • 3
0

You can use pandas DataFrames style.format function to apply a formatting to a column like in https://towardsdatascience.com/style-pandas-dataframe-like-a-master-6b02bf6468b0. If you want to round the numbers to i.e. 2 decimal places follow the accepted answer in Python float to Decimal conversion. Conversion to an int reduces accuracy a bit too much i think

For the conecpt binary floats in general (what float64 is) see Python - round a float to 2 digits

ralf htp
  • 9,149
  • 4
  • 22
  • 34
0

Please use pd.set_option to control the precision's to be viewed

>>> import pandas as pd
>>> a = pd.DataFrame({'sam':[7.500505e+09]})
>>> pd.set_option('float_format', '{:f}'.format)
>>> a
                sam
0 7500505000.000000
>>>