-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
[READY] perf improvements for strftime #51298
Open
smarie
wants to merge
154
commits into
pandas-dev:main
Choose a base branch
from
smarie:feature/44764_perf_issue_new
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
154 commits
Select commit
Hold shift + click to select a range
a9ba5de
`period_format` now has a faster default formatter leveraging python …
a6c06c9
class `_Period`: new method `fast_strftime`
34113d4
class `Timestamp`: new method `fast_strftime`
5dd7ab4
New module in tslibs: `strftime.py`. New function in this module: `co…
8a7c039
`format_array_from_datetime`: new boolean argument `fast_strftime` to…
f2d2fb1
datetimelike `strftime`: new boolean argument `fast_strftime` to use …
fac90d7
`DatetimeIndexOpsMixin.format` and `_format_with_header`: new boolean…
2fc70a6
`NDFrame.to_csv` and `DataFrameRenderer.to_csv` and `CSVFormatter.__i…
6edda53
Added tests for the `to_csv` dataframe method to cover the new fast_s…
b4c815d
`TestCategoricalRepr`: added a test for dates without time, with time…
eaa1dc9
Fixed `test_nat` and `test_api` with the new symbols added
3254b54
New `test_strftime` module to cover the `strftime.py` module in tslib.
0f69286
`convert_strftime_format` argument `target` is now mandatory to avoid…
72fe379
`convert_strftime_format`: Completed unsupported directives for datet…
eda4243
Fixed bug in tslib `format_array_from_datetime`
442732f
Fixed issue in `format_array_from_datetime` when tz was not None
5ae3707
Added 2 todos
62aca61
`test_format`: Added various tests for the new feature
86cc1c8
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
6412911
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
2ec16ba
Fixed Datetime64TZFormatter issue due to arg renaming in recent commits
c325431
Added 2 asv benchs for strftime with iso8601 format, and a variant fo…
6c1188a
blackened, flake8, and removed asv main
1fad7b6
Minor improvement
e33ad65
Added new ASVs for strftime
6456694
Added asvs for period
91ad194
Added asvs for datetime and period indexes .format
80ebc82
`convert_strftime_format` is now part of the public API as it is requ…
087a949
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
bf170ba
Updated whats new 1.5.4
1f3db30
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
4b34639
Fixed issues following the merge from latest main. Introduced new fun…
6e189ad
Improved ASV bench slightly (added datetime index formatting tests)
9152dbc
Merged whatsnew
35a39a0
pre-commit and docstring checks
d13895b
blackened
35e4c34
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
4007330
Added two asvs
3d8d469
Fixed mypy error
1fc3d48
Fixed ASV bench
6928941
Improved ASV benchs
7c87a2f
Fixed RST format in whatsnew
21b7c9d
Hopefully fixed the ASV bench for the case when the format is the def…
fdb7309
Fixed issue in period.pyx
636f27f
Made hooks happy
1773a0d
Merge branch 'main' into feature/44764_perf_issue_new
smarie 3b96d0b
Fixed variables used before initialization
3433c16
pre-commit hook upgrade
234685c
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
227f188
Fixed error in period.pyx
9c03fe4
Fixed issue: there was no need to encode to bytes to apply string for…
d44a4c9
Fixed issue: there was no need to encode to bytes to apply string for…
9a94960
Merge remote-tracking branch 'origin/feature/44764_perf_issue_new' in…
f9565ff
Revert "Fixed issue: there was no need to encode to bytes to apply st…
3a87c64
Fixed issue: there was no need to encode to bytes to apply string for…
bc5cb66
Removed todo in timedeltas.pyx
812aa2a
Fixed asv bench
69a9b67
Fixed ASV
abaf0cb
Fixed indentation issue
7c32a44
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
537b9f7
Doc fix whatsnew entries sorted
f7307f4
Improved speed of csv formatting of datetimeindex
f9e3b5f
pre-commit fixes
9cf6d79
Removed invalid comment
smarie f42fe43
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
9e51d82
Fixed typo
c2e150b
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
8339062
Fixed whatsnew
72df87c
Fixed changelog indentation error: now a one-liner
0851d55
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
ebb22e8
Fixed mypy error
a5869c4
Fixed mypy error 2
14c9cfe
Fixed whatsnew
e1ed22c
Fixed whatsnew ?
6a502fc
Fixed whatsnew ?
d340635
Merge branch 'main' into feature/44764_perf_issue_new
smarie 14b8c37
Merge branch 'main' into feature/44764_perf_issue_new
smarie cb5bfd9
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
022c185
Moved whatsnew items
21b0a88
Re applied mods to `TestPeriodIndexFormat`, since it had moved somewh…
ec8036c
Re applied mods to `TestDatetimeIndexFormat`, since it had moved some…
85c65a6
Re applied mods from `TestFastStrfTimeScalars` in the right places
6c35bad
Merge remote-tracking branch 'origin/feature/44764_perf_issue_new' in…
bac97f9
Ruff: Fixed invalid character in comment
324052b
black+isort+fixed tests
20e38ef
Implemented conservative fallback as suggested per code review
9602eb5
black
9223451
Implemented hypothesis tests as suggested per code review
5ffc88d
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
fb0e30c
Removed the `fast_strftime` argument everywhere as suggested per code…
4ef8ec1
Fixed docstring
3c50a76
Trying to have meson understand that there is a py file in the tslib
3e4cd1e
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
e41df33
Fixed ruff error
6e0e092
Fixed tests
83d5539
Fixed test
cd4d4f0
Fixed test
4198ea6
Fixed test
8e2ef29
Fixed test for musl linux
d0c3845
Fixed mypy errors
a3fcd6c
Fixed mypy error
0390344
Fixed mypy error
f43e511
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
18fa4d5
Merge branch 'main' into feature/44764_perf_issue_new
smarie 4521a1e
Merge branch 'main' into feature/44764_perf_issue_new
smarie cc1a4d2
Merge branch 'main' into feature/44764_perf_issue_new
smarie 9cff856
Merge branch 'main' into feature/44764_perf_issue_new
smarie 42e87c6
Removed `convert_strftime_format` from top-level API and moved it to …
404ab84
Merge remote-tracking branch 'origin/feature/44764_perf_issue_new' in…
1726096
Merge branch 'main' into feature/44764_perf_issue_new
smarie 3dd707c
isort
ea28669
Merge remote-tracking branch 'origin/feature/44764_perf_issue_new' in…
a94aec0
Merge branch 'main' into feature/44764_perf_issue_new
smarie aa4b0f6
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
a382325
As per code review: instance level `fast_strftime` are now private `_…
d2ef85e
Added maintenance comment
b0471a7
black+isort
bbbf721
Moved changelog to 3.0.0 and improved it slightly
5ea765c
Merge branch 'feature/44764_perf_issue_new' of https://github.com/sma…
691b127
Fixed test: fast_strftime not part of api anymore (private)
c41e8c9
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
e0ddfcb
formatting
b09c641
Fixed ASV benchmark: format method disappeared from DateTimeIndex
a519427
Improved what's new
c58d5eb
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
098e53e
Fixed ASV error
9ad010c
Merge branch 'main' into feature/44764_perf_issue_new
smarie e719599
Code review: renamed `loc_s` into `locale_dt_strings`
ffc661d
Code review: moved whats new entry to perf
b6442d3
Code review: removed commented out code
40a5c48
Code review: added support for negative and small years and added cor…
b0f73f5
Merge remote-tracking branch 'origin/feature/44764_perf_issue_new' in…
084f124
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
b4983f8
Improved test for small years
159f1bd
Fixed failing test
76fb52e
Fixed failing test
c88e52d
Merge branch 'main' into feature/44764_perf_issue_new
smarie 103d9cf
Fixed test on linux
478ea4e
Trying to debug datetime.strftime on linux
51431b3
Fixed tests on linux and windows
847a9f3
Removed useless comment
338404c
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
a21837c
Fixed tests on linux musl
fc03926
Attempt to fix on MUSL
03dfc52
Fixed test for linux musl
2b98619
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
514e785
Simplified `convert_strftime_format` as per code review
d130c22
Renamed `fast_strftime` with `strftime_pystr` as per code review
d6d6905
Merge branch 'main' of https://github.com/pandas-dev/pandas into feat…
66b5bbe
Fixed test on WASM/Pyodide
25ad4fb
Renamed internal argument ``strftime_pystr`` into ``_use_pystr_engine…
5001569
Fixed test on pyodide
48a0096
Fixed cython-lint error
3e86c1f
Merge branch 'main' into feature/44764_perf_issue_new
smarie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter tz_aware is being used to toggle between timezone-aware and naive timestamps. However, the logic for handling timezone-aware data in the setup method is somewhat repetitive and could benefit from encapsulation in a utility function.
Extract the logic for timezone localization into a helper function to improve readability and maintainability.
For example:
`
def localize_if_required(dataframe, tz_aware):
if tz_aware:
dataframe["dt"] = dataframe["dt"].dt.tz_localize("UTC")
dataframe["d"] = dataframe["d"].dt.tz_localize("UTC")
`