-
-
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
DEPS: Make pytz an optional dependency #59089
Conversation
pandas/_libs/tslibs/timezones.pyx
Outdated
@@ -45,7 +38,7 @@ from pandas._libs.tslibs.util cimport ( | |||
|
|||
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 |
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.
cant we keep this as a tzinfo object?
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.
Ah I had thought cython wouldn't like tzinfo since this could be None
, but was able to keep as tzinfo
pandas/_libs/tslibs/timezones.pyx
Outdated
if ZoneInfo is None: | ||
return False | ||
return isinstance(tz, ZoneInfo) | ||
return isinstance(tz, zoneinfo.ZoneInfo) |
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.
might be a small bump by doing cdef type ZoneInfo
at the module level?
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.
Sure thing. Added
Will merge at the end of the week if there are no further comments |
* 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
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.This makes pandas return zoneinfo.ZoneInfo objects by default from string inputs