-
-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: floating point precision on writing/reading to csv #13159
Comments
Specify required precision via
Maybe doc should have |
yes this is a tradeoff between speed of reading and exactness out to a certain ULP. as @sinhrks indicated for reading we offfer a higher precision option; writing is subject to the vagaries of floating point to stringifciation. |
I think writing should have something similar to I haven't looked at the code, but the difference here seems to be related to defaulting to |
Please also consider the case where different columns having different rounding levels. |
take |
@dhavide Is this issue resolved? Can I take this issue? |
take |
Tested the original error with python3(3.10.14), printed values are as expected. Specifically, see code:
output
|
Code Sample
Expected Output
output of
pd.show_versions()
(Note that there are two, presented side-by-side, with results underneath)
Results from left setup (0.15.1):
Results from right setup (0.18.0):
Expectations
I expect to be able to write a DataFrame to a csv file and later read it in to a new DataFrame such that the two DataFrames will be identical. The older version (result 0.15.1) is quite a bit better than the newer (since I can round to three decimal places to get the expected results or read from a filehandle instead of using
from_csv()
orread_csv()
). The newer version (0.18.0) loses information, which is not acceptable.Note that the documentation at http://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.DataFrame.from_csv.html reads
But this does not describe what actually happens, as demonstrated above.
The text was updated successfully, but these errors were encountered: