-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: annotations in core.groupby #35939
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
Changes from all commits
4c5eddd
c632c9f
9e64be3
42649fb
47121dd
1decb3e
57c5dd3
a358463
ffa7ad7
e5e98d4
408db5a
d3493cf
75a805a
9f61070
2d10f6e
3e20187
e27d07f
c52bed4
5f71a05
f832baa
bde6dac
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 |
---|---|---|
|
@@ -568,7 +568,9 @@ def codes(self) -> np.ndarray: | |
@cache_readonly | ||
def result_index(self) -> Index: | ||
if self.all_grouper is not None: | ||
return recode_from_groupby(self.all_grouper, self.sort, self.group_index) | ||
group_idx = self.group_index | ||
assert isinstance(group_idx, CategoricalIndex) # set in __init__ | ||
return recode_from_groupby(self.all_grouper, self.sort, group_idx) | ||
Comment on lines
+571
to
+573
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. is this needed. are the type annotations for in __init__
or
so self._group_index can only be CategoricalIndex or None and group_index can only be CategoricalIndex ? 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. IIRC its the self.all_grouper check a few lines up that ensures we have a CategoricalIndex here 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. self.all_grouper is not None when is_categorical_dtype(self.grouper) so I don't think that narrows it. (but I may need to trace through further) |
||
return self.group_index | ||
|
||
@property | ||
|
@@ -607,7 +609,7 @@ def get_grouper( | |
mutated: bool = False, | ||
validate: bool = True, | ||
dropna: bool = True, | ||
) -> "Tuple[ops.BaseGrouper, List[Hashable], FrameOrSeries]": | ||
) -> Tuple["ops.BaseGrouper", List[Hashable], FrameOrSeries]: | ||
""" | ||
Create and return a BaseGrouper, which is an internal | ||
mapping of how to create the grouper indexers. | ||
|
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.
add type parameters for Callable (if you can)
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.
its going to end up being
wrapper(self, *args, **kwargs) -> FrameOrSeriesUnion
. Is thatCallable[..., FrameOrSeriesUnion]
?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