0

when I convert a column from string to float I lose decimal places, is there a clear way how to keep decimal places?

dicti = {'1': ['55.230530663425',
  '43.597357785755'],
 '2': ['25.231784186637',
  '93.59759890623'],
 '3': ['75.229467797447',
  '33.597732846763'],
 '4': ['15.228959922301',
  '33.596897400263'],
 '5': ['95.231278845519',
  '23.599502230125']}


df = pd.DataFrame.from_dict(dicti, 'index')
df[0] = df[0].astype(float)
df[1] = df[1].astype(float)
print(df)

           0          1
1  55.230531  43.597358
2  25.231784  93.597599
3  75.229468  33.597733
4  15.228960  33.596897
5  95.231279  23.599502
hello543
  • 137
  • 7

1 Answers1

1

Check out the top answer from

Pandas data precision

to see how to change the display precision if you want to see more decimal places. As has been said, the full precision is stored, just not displayed.

RustyPython
  • 370
  • 1
  • 7