-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: DataFrame.groupby(., dropna=True, axis=0) incorrectly throws ShapeError #35751
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 4 commits
0484244
a335744
640ec38
099e30c
8a13d06
394feb6
e1cafd4
0df329c
77e7fc7
16544ea
46e5f66
6fca785
6341d97
269516b
6819ac6
2ec491d
249fc2a
b1cafad
bef1437
9abc8c4
c63a24c
9791e1e
21a6fbb
8afb6e2
239e16a
0cdea22
ee73640
c07df76
ca2f898
e15df1a
342540f
90e687b
a10a933
bddfa81
2adba09
531414f
10ee18a
2fcfda0
1969bc4
2972ee4
62caeb6
557903f
deb1b09
3d579c5
ec85d7f
f6a9724
bfe6cde
b6fd41c
983bb8e
1884133
f207709
4422a21
daa60a6
5658c12
4326b79
e12e8d9
9e6a130
1770cc2
6a005dc
74dbe4f
0e9db9c
8be535c
91940c7
85d2165
c31b49f
21bfc82
7f67086
5555585
5ac7fbf
1e7ab91
96b5af4
9cf9e05
f5a1635
bd1abf9
a789b6a
2ba8b44
95b86ba
7881134
15aa56e
08f0abd
8ab9baa
faf6570
7bd2a9a
24bb112
4377b63
de86144
9bc9ce4
1ea9d29
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 |
---|---|---|
|
@@ -556,8 +556,9 @@ def _transform_general( | |
if common_dtype is result.dtype: | ||
result = maybe_downcast_numeric(result, self._selected_obj.dtype) | ||
|
||
result.name = self._selected_obj.name | ||
result.index = self._selected_obj.index | ||
rhshadrach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
obj = self._selected_obj.dropna() if self.dropna else self._selected_obj | ||
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. Do we need to actually drop the data itself? I thought dropna should just include whether we include the NA group (which the factorize call handled)? 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. Yes you're right. We actually don't really need the whole 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. Actually it's fine to delete this* - so definitely not needed
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. Looks like there was a desire for 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. Ok! Deleting was maybe heavy-handed. Actually |
||
result.name = obj.name | ||
result.index = obj.index | ||
return result | ||
|
||
def _transform_fast(self, result) -> Series: | ||
|
@@ -1677,12 +1678,17 @@ def _gotitem(self, key, ndim: int, subset=None): | |
exclusions=self.exclusions, | ||
as_index=self.as_index, | ||
observed=self.observed, | ||
dropna=self.dropna, | ||
) | ||
elif ndim == 1: | ||
if subset is None: | ||
subset = self.obj[key] | ||
return SeriesGroupBy( | ||
subset, selection=key, grouper=self.grouper, observed=self.observed | ||
subset, | ||
selection=key, | ||
grouper=self.grouper, | ||
observed=self.observed, | ||
dropna=self.dropna, | ||
) | ||
|
||
raise AssertionError("invalid ndim for _gotitem") | ||
|
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.
missing values in the grouper? with dropna?
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.
rewrote, mentioned grouper. Also separated this entry from #35014