0

I am reading a .dat file which has float value like "-1.752", when i read this value using read_csv I am getting "-1.7519999999999998" value.

Not sure how to fix this extra decimal values.

Below is the code i used it: SOU2PD=pd.read_csv(file_loc+file_name+".dat", sep='\x01',header=None,engine='python',dtype={5 : float,9:float,11:float}).

Please suggest me.

Rahul Agarwal
  • 4,034
  • 7
  • 27
  • 51
Alexsander
  • 603
  • 1
  • 6
  • 15
  • You can look into this question.. https://stackoverflow.com/questions/47368296/pandas-read-csv-file-with-float-values-results-in-weird-rounding-and-decimal-dig – Bhaskar Oct 17 '18 at 11:45
  • I've marked this as a duplicate of a Q&A which has a solution. But if it doesn't help, please specify *in your question* exactly what you have tried and, if possible, provide example data which exhibits the problem. – jpp Oct 17 '18 at 11:53
  • jpp, i tried the solution given in the above link. when i tried the option float_precision='round_trip', i am getting the error message "The 'float_precision' option is not supported with the 'python' engine" – Alexsander Oct 17 '18 at 12:20

0 Answers0