0

Attempting to get rid of scientific notation for a column in a dataframe:

Dataframe has 3 columns: Currency1, Currency2, Rate

When I do: print(data.dtypes) Currency1, Currency2 are type object, Rate is type float64.

I have tried doing: data['Rate'] = data['Rate'].astype(str) which doesn't remove the scientific notation.

I need to then output this to a CSV file, so can't use the print options etc. Is there another way please to remove the scientific notation?

Jerry12345678
  • 251
  • 1
  • 2
  • 6
  • You might want to use a string formatter to format the floats inside your strings: https://stackoverflow.com/questions/20937538/how-to-display-pandas-dataframe-of-floats-using-a-format-string-for-columns – albert Jul 22 '21 at 11:34
  • When I do data.options.display.float_format = '$:,.10f}'.format it errors and says 'builtin_function_or_method' object has no attribute 'options'. Also, I need to output this to a csv, so would this actually fix it for that too? – Jerry12345678 Jul 22 '21 at 11:50

0 Answers0