2

How can I suppress scientific notation for integer numbers in data frames in Pandas?

I got this:

48726528
97573906
7E+07

instead of this:

48726528
97573906
69857386
Oussama He
  • 555
  • 1
  • 10
  • 31
  • if you type: `np.set_printoptions(suppress=True)` and execute before printing this does it solve? – anky Mar 12 '19 at 17:31
  • or check this too: https://stackoverflow.com/questions/41157981/pandas-convert-float-in-scientific-notation-to-string – anky Mar 12 '19 at 17:33
  • @anky_91`np.set_printoptions(suppress=True)` doesn't work. I got `AttributeError: module 'pandas' has no attribute 'set_printoptions'` – Oussama He Mar 12 '19 at 17:41
  • that is after `import numppy as np` also check the second link – anky Mar 12 '19 at 17:46
  • what is `df.dtypes` or `Series.dtype` (if it's a Series). Are you sure you don't have a `NaN` value somewhere in your column, which is casting it to `float`? – ALollz Mar 12 '19 at 17:49

1 Answers1

4

You need to be sure that your values are indeed integers. If you wish, you can convert it in integers: df[your_column].astype(int)