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

PERF: Improve performance in to_csv with date format for index #44908

Merged
merged 3 commits into from
Dec 16, 2021

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 15, 2021

Before:

%timeit df.to_csv(date_format='%Y-%m-%d %H:%M:%S')
1.05 s ± 11.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

afterwards:

%timeit df.to_csv(date_format='%Y-%m-%d %H:%M:%S')
392 ms ± 4.31 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

@phofl phofl added IO CSV read_csv, to_csv Performance Memory or execution speed performance labels Dec 15, 2021
Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

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

LGTM

@jreback jreback added this to the 1.4 milestone Dec 16, 2021
@jreback jreback merged commit 862c284 into pandas-dev:master Dec 16, 2021
@jreback
Copy link
Contributor

jreback commented Dec 16, 2021

thanks @phofl wouldn't object to addtitional benchmarks as specified in the OP

@phofl
Copy link
Member Author

phofl commented Dec 16, 2021

We have some of them already, will check and add as necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO CSV read_csv, to_csv Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Performance regression to_csv when formatting datatime index
3 participants