Skip to content
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[rust, python]: add float_precision parameter to DataFrame.write_csv #4504

Merged
merged 2 commits into from
Aug 19, 2022

Conversation

matteosantama
Copy link
Contributor

@matteosantama matteosantama commented Aug 19, 2022

Closes #4279 and #1125

Unfortunately lexical does not provide a way to specify the number of decimals to write (see this comment) but we still use the fast-path when no float_precision is specified (by default).

@github-actions github-actions bot added python Related to Python Polars rust Related to Rust Polars labels Aug 19, 2022
@matteosantama matteosantama changed the title feat[rust, python]: add float_precision control to DataFrame.write_csv feat[rust, python]: add float_precision parameter to DataFrame.write_csv Aug 19, 2022
Copy link
Member

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have a few minor remarks.

polars/polars-io/src/lib.rs Outdated Show resolved Hide resolved
polars/polars-io/src/csv/mod.rs Outdated Show resolved Hide resolved
polars/polars-io/Cargo.toml Outdated Show resolved Hide resolved
@matteosantama matteosantama force-pushed the float-precision branch 2 times, most recently from 6b85307 to 9a827c5 Compare August 19, 2022 15:59
@matteosantama
Copy link
Contributor Author

Removed all benchmarking code

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2022

Codecov Report

Merging #4504 (35e70b4) into master (de93b31) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4504      +/-   ##
==========================================
+ Coverage   79.33%   79.34%   +0.01%     
==========================================
  Files         493      493              
  Lines       77667    77708      +41     
==========================================
+ Hits        61614    61656      +42     
+ Misses      16053    16052       -1     
Impacted Files Coverage Δ
py-polars/polars/internals/dataframe/frame.py 94.20% <ø> (ø)
polars/polars-io/src/csv/write.rs 98.41% <100.00%> (+0.16%) ⬆️
polars/polars-io/src/csv/write_impl.rs 86.44% <100.00%> (+5.67%) ⬆️
py-polars/src/dataframe.rs 91.15% <100.00%> (+0.01%) ⬆️
...ars/polars-core/src/series/implementations/utf8.rs 71.53% <0.00%> (-1.13%) ⬇️
polars/polars-core/src/series/series_trait.rs 13.33% <0.00%> (-1.06%) ⬇️
polars/polars-time/src/series/mod.rs 57.33% <0.00%> (-0.67%) ⬇️
polars/polars-lazy/src/logical_plan/iterator.rs 97.45% <0.00%> (-0.64%) ⬇️
polars/polars-core/src/utils/mod.rs 87.50% <0.00%> (-0.30%) ⬇️
...olars/polars-core/src/frame/groupby/into_groups.rs 58.67% <0.00%> (-0.28%) ⬇️
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ritchie46 ritchie46 merged commit cc9667c into pola-rs:master Aug 19, 2022
@matteosantama matteosantama deleted the float-precision branch August 19, 2022 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

write_csv needs precision and/or format input for floating point numbers
3 participants