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

fix(rust,python): ensure trailing quote is written for temporal data when CSV quote_style is non-numeric #11328

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Sep 26, 2023

Closes #11324.

We missed writing the trailing quote for datetime values in CSV output when quote_style was "non_numeric". Fixed, and extended the related test-coverage to include date/datetime values.

Example

import polars as pl
from datetime import datetime
df = pl.DataFrame({"dtm": [datetime.now(), datetime.now()]})

Before

(datetime values are missing trailing quotes)

print( df.write_csv( has_header=True, quote_style = 'non_numeric') )
# "dtm"
# "2023-09-26T11:59:34.345885
# "2023-09-26T11:59:34.345931

After

print( df.write_csv( has_header=True, quote_style = 'non_numeric') )
# "dtm"
# "2023-09-26T11:59:34.345885"
# "2023-09-26T11:59:34.345931"

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Sep 26, 2023
Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

Good to go if CI passes 👍

@alexander-beedie
Copy link
Collaborator Author

alexander-beedie commented Sep 26, 2023

Good to go if CI passes 👍

Lint isn't happy - will take a look.
Update: got it...

@stinodego stinodego merged commit 1f0450a into pola-rs:main Sep 26, 2023
24 checks passed
@alexander-beedie alexander-beedie deleted the write-trailing-non-numeric-quote branch September 26, 2023 13:14
romanovacca pushed a commit to romanovacca/polars that referenced this pull request Oct 1, 2023
…when CSV `quote_style` is non-numeric (pola-rs#11328)

Co-authored-by: Stijn de Gooijer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix 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 does not properly quote datetime columns
3 participants