Skip to content

Commit 31f93e5

Browse files
committed
Add a test and whatsnew item for GH pandas-dev#9700
1 parent 5efb281 commit 31f93e5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

doc/source/whatsnew/v0.16.1.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,4 @@ Bug Fixes
245245

246246
- Bug in hiding ticklabels with subplots and shared axes when adding a new plot to an existing grid of axes (:issue:`9158`)
247247
- Bug in ``transform`` and ``filter`` when grouping on a categorical variable (:issue:`9921`)
248-
248+
- Bug in ``transform`` when groups are equal in number and dtype to the input index (:issue:`9700`)

pandas/tests/test_groupby.py

+6
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,12 @@ def demean(arr):
959959
g = df.groupby(pd.TimeGrouper('M'))
960960
g.transform(lambda x: x-1)
961961

962+
# GH 9700
963+
df = DataFrame({'a' : range(5, 10), 'b' : range(5)})
964+
result = df.groupby('a').transform(max)
965+
expected = DataFrame({'b' : range(5)})
966+
tm.assert_frame_equal(result, expected)
967+
962968
def test_transform_fast(self):
963969

964970
df = DataFrame( { 'id' : np.arange( 100000 ) / 3,

0 commit comments

Comments
 (0)