-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: Add float_scientific
option to write_csv
/sink_csv
#17111
Conversation
4aafafb
to
42c86af
Compare
42c86af
to
2881ae0
Compare
float_scientific
option to write_csv
/sink_csv
a51e49d
to
871f975
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17111 +/- ##
==========================================
+ Coverage 80.86% 80.88% +0.02%
==========================================
Files 1456 1456
Lines 191141 191410 +269
Branches 2728 2739 +11
==========================================
+ Hits 154562 154824 +262
- Misses 36073 36079 +6
- Partials 506 507 +1 ☔ View full report in Codecov by Sentry. |
These same lines were not covered in the tests previously, so my addition of similar functions adds some lines that are not covered. I don’t think it should be possible to trigger this error condition through the Python API. |
Alright. Thanks @lukeshingles |
@lukeshingles this only partially addresses the original issue (#11929) that I raised. There's still no pure-Rust equivalent of |
Closes #11929.
This PR adds an optional boolean float_scientific keyword option to write_csv and sink_csv that can be None (default to previous automatic behaviour), true (always use scientific notation), false (always use positional notation).
Prior to this PR, either scientific or positional notation is chosen automatically for each float value during write_csv, unless float_precision is set, in which case positional notation is always used. In my own application, I want to output in scientific notion (since values can be extremely small, e.g. 10^-15) but use float_precision=4 to keep only a few significant figures to reduce the output file size. Performing the formatting in python is about 15x slower than this solution.