DEPS: Make pytz an optional dependency#59089
Merged
mroeschke merged 28 commits intopandas-dev:mainfrom Aug 12, 2024
Merged
Conversation
5 tasks
| cdef int64_t NPY_NAT = get_nat() | ||
| cdef tzinfo utc_stdlib = timezone.utc | ||
| cdef tzinfo utc_pytz = pytz.utc | ||
| cdef object utc_pytz = pytz.UTC if pytz else None |
Member
There was a problem hiding this comment.
cant we keep this as a tzinfo object?
Member
Author
There was a problem hiding this comment.
Ah I had thought cython wouldn't like tzinfo since this could be None, but was able to keep as tzinfo
| if ZoneInfo is None: | ||
| return False | ||
| return isinstance(tz, ZoneInfo) | ||
| return isinstance(tz, zoneinfo.ZoneInfo) |
Member
There was a problem hiding this comment.
might be a small bump by doing cdef type ZoneInfo at the module level?
Member
Author
|
Will merge at the end of the week if there are no further comments |
shreyas-dev
pushed a commit
to shreyas-dev/pandas
that referenced
this pull request
Aug 13, 2024
* Make pytz an optional dependency * Start to address tests * Fix tests * Fix tests * Fix test, import optional pytz in conftest * Fix formatting * Change minimum * remove type ignore * another pa under 17 * Address comments * Undo file * Fix pyarrow 17 test * Test xpasses on pyarrow 18
3 tasks
3 tasks
Closed
3 tasks
baryluk
reviewed
Jul 9, 2025
| ts = pd.Timestamp(2024, 1, 1).tz_localize("US/Pacific") | ||
| ts.tz | ||
|
|
||
| ``pytz`` timezone objects are still supported when passed directly, but they will no longer be returned by default |
There was a problem hiding this comment.
pytztimezone objects are still supported when passed directly, but they will no longer be returned by default
This is a bit confusing. It suggests, that pd.Timestamp and others can be used to make it do return pytz objects.
3 tasks
1 task
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.This makes pandas return zoneinfo.ZoneInfo objects by default from string inputs