-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: remove kwargs from Index._simple_new #29604
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: remove kwargs from Index._simple_new #29604
Conversation
nice |
def difference(self, other, sort=None): | ||
new_idx = super().difference(other, sort=sort) | ||
new_idx.freq = None | ||
return new_idx |
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.
could this be shared in one of the datetimelike classes?
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 don't think so: PeriodIndex doesn't allow freq=None
and DatetimeIndexOpsMixin
is shared with that`. Don't know if that's a bug in PeriodIndex or as intended, as I haven't worked much with datetime objects.
My motivation with this is getting kwargs out of a basic method and make child classes just build on that using super
+ the specific stuff. That is easier to reason about IMO.
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.
Small comment, looks good for the rest!
@@ -464,6 +464,11 @@ def _convert_for_op(self, value): | |||
return _to_M8(value) | |||
raise ValueError("Passed item and index have different timezone") | |||
|
|||
def difference(self, other, sort=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.
Can you add a docstring here? (I think you can use one of the decorators to append Index.difference.__doc__
)
(and same below)
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.
added.
fe28788
to
2109eae
Compare
lgtm. merge on green. |
Removes kwargs from
Index._simple_new
.The kwargs are actually ony used by
DateTimeIndex.difference
andTimeDeltaIndex.difference
.