-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Updating _resolve_numeric_only function of GroupBy #43154
Changes from 29 commits
6b0f5e7
116534f
7b5ecb4
7faf1fc
d773e7a
5b4e799
3d2e78e
5836f91
1eb0e25
a0391e6
2a1835a
66ecb96
c80fa9e
95b6533
fa8a8ca
e3f6767
ed668e6
f30855a
65261b4
2477aa3
da24f29
4075353
463a7c9
dd562c5
f400174
56f28d7
4fd254b
a3b09e6
f7e2d59
270549a
17808bf
08b2429
e141123
45f54d6
0012423
a9a63e7
d46091e
a39e5ce
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 |
---|---|---|
|
@@ -1102,14 +1102,11 @@ def _wrap_applied_output(self, data, keys, values, not_indexed_same: bool = Fals | |
def _resolve_numeric_only(self, numeric_only: bool | lib.NoDefault) -> bool: | ||
""" | ||
Determine subclass-specific default value for 'numeric_only'. | ||
|
||
For SeriesGroupBy we want the default to be False (to match Series behavior). | ||
For DataFrameGroupBy we want it to be True (for backwards-compat). | ||
|
||
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. restore this one too. 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. I"ve done this in 45f54d6 |
||
Parameters | ||
---------- | ||
numeric_only : bool or lib.no_default | ||
|
||
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. and this 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. I"ve done this in 45f54d6 |
||
Returns | ||
------- | ||
bool | ||
|
@@ -1120,12 +1117,15 @@ def _resolve_numeric_only(self, numeric_only: bool | lib.NoDefault) -> bool: | |
if self.obj.ndim == 2: | ||
# i.e. DataFrameGroupBy | ||
numeric_only = True | ||
obj = self._obj_with_exclusions | ||
jreback marked this conversation as resolved.
Show resolved
Hide resolved
|
||
check = obj._get_numeric_data() | ||
if len(obj.columns) and not len(check.columns) and not obj.empty: | ||
warnings.warn("... Explicitly pass numeric_only ...") | ||
rhshadrach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
numeric_only = False | ||
jreback marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
else: | ||
numeric_only = False | ||
|
||
# error: Incompatible return value type (got "Union[bool, NoDefault]", | ||
# expected "bool") | ||
return numeric_only # type: ignore[return-value] | ||
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. can you restore this too. The mypy error needs to be ignored as mypy does not know that 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.
I assume the release note should be added in v1.4.0.rst 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.
I"ve done this in 45f54d6 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.
We discussed at pandas dev meeting today, and put this in v1.3.3.rst |
||
return numeric_only | ||
|
||
# ----------------------------------------------------------------- | ||
# numba | ||
|
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 restore this whitespace. docstrings should start with a one-liner summary distinct from the expanded description.
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"ve done this in 45f54d6