-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN refactor core indexes #37582
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
CLN refactor core indexes #37582
Changes from 3 commits
5685cb1
7695e66
d5d4530
23be6a5
b3d1dec
1b0d92c
e0d36eb
fb2bea0
26c419e
d076431
bb0fc86
445f2e9
e8f117c
f1f1deb
e860c45
a58de56
98672b1
be80fb7
dc0b84e
4074a88
00d6be0
d073da9
fdafd36
01c4a06
1b254ae
dffc440
63a8575
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -425,12 +425,13 @@ def _maybe_utc_convert(self, other: Index) -> Tuple["DatetimeIndex", Index]: | |
this = self | ||
|
||
if isinstance(other, DatetimeIndex): | ||
if self.tz is not None: | ||
if other.tz is None: | ||
raise TypeError("Cannot join tz-naive with tz-aware DatetimeIndex") | ||
elif other.tz is not None: | ||
if ( | ||
(self.tz is not None) | ||
and (other.tz is None) | ||
or (self.tz is None) | ||
and (other.tz is not None) | ||
): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this not viable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as in,
? I don't think that would work because we don't want to raise if both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah sorry, I didn't actually know that was a Python command - that should work then, thanks so much! |
||
raise TypeError("Cannot join tz-naive with tz-aware DatetimeIndex") | ||
|
||
if not timezones.tz_compare(self.tz, other.tz): | ||
this = self.tz_convert("UTC") | ||
other = other.tz_convert("UTC") | ||
|
@@ -758,8 +759,7 @@ def _get_string_slice(self, key: str): | |
freq = getattr(self, "freqstr", getattr(self, "inferred_freq", None)) | ||
parsed, reso = parsing.parse_time_string(key, freq) | ||
reso = Resolution.from_attrname(reso) | ||
loc = self._partial_date_slice(reso, parsed) | ||
return loc | ||
return self._partial_date_slice(reso, parsed) | ||
|
||
def slice_indexer(self, start=None, end=None, step=None, kind=None): | ||
""" | ||
|
@@ -822,7 +822,7 @@ def slice_indexer(self, start=None, end=None, step=None, kind=None): | |
# -------------------------------------------------------------------- | ||
|
||
def is_type_compatible(self, typ) -> bool: | ||
return typ == self.inferred_type or typ == "datetime" | ||
return typ in [self.inferred_type, "datetime"] | ||
|
||
@property | ||
def inferred_type(self) -> str: | ||
|
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.
i think we did it this way to make coverage obvious