Skip to content

Commit

Permalink
Merge branch 'main' into issue-50395
Browse files Browse the repository at this point in the history
  • Loading branch information
kostyafarber authored Jan 24, 2023
2 parents cf1268a + 33f4f7b commit bebfec5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@ Groupby/resample/rolling
- Bug in :class:`.DataFrameGroupBy` would raise when used with an empty DataFrame, categorical grouper, and ``dropna=False`` (:issue:`50634`)
- Bug in :meth:`.SeriesGroupBy.value_counts` did not respect ``sort=False`` (:issue:`50482`)
- Bug in :meth:`.DataFrameGroupBy.resample` raises ``KeyError`` when getting the result from a key list when resampling on time index (:issue:`50840`)
- Bug in :meth:`.DataFrameGroupBy.transform` and :meth:`.SeriesGroupBy.transform` would raise incorrectly when grouper had ``axis=1`` for ``"ngroup"`` argument (:issue:`45986`)
-

Reshaping
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -3394,7 +3394,7 @@ def ngroup(self, ascending: bool = True):
dtype: int64
"""
with self._group_selection_context():
index = self._selected_obj.index
index = self._selected_obj._get_axis(self.axis)
comp_ids = self.grouper.group_info[0]

dtype: type
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/groupby/transform/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ def test_transform_broadcast(tsframe, ts):
def test_transform_axis_1(request, transformation_func):
# GH 36308

if transformation_func == "ngroup":
msg = "ngroup fails with axis=1: #45986"
request.node.add_marker(pytest.mark.xfail(reason=msg))

df = DataFrame({"a": [1, 2], "b": [3, 4], "c": [5, 6]}, index=["x", "y"])
args = get_groupby_method_args(transformation_func, df)
result = df.groupby([0, 0, 1], axis=1).transform(transformation_func, *args)
Expand Down

0 comments on commit bebfec5

Please sign in to comment.