Skip to content

Commit a718962

Browse files
mroeschkejreback
authored andcommitted
TST: Groupby/transform with grouped NaN (#9941) (#14907)
1 parent 37b22c7 commit a718962

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/groupby/test_groupby.py

+9
Original file line numberDiff line numberDiff line change
@@ -1374,6 +1374,15 @@ def test_groupby_transform_with_int(self):
13741374
expected = DataFrame(dict(B=1, C=[2, 3, 4, 10, 5, -1]))
13751375
assert_frame_equal(result, expected)
13761376

1377+
def test_groupby_transform_with_nan_group(self):
1378+
# GH 9941
1379+
df = pd.DataFrame({'a': range(10),
1380+
'b': [1, 1, 2, 3, np.nan, 4, 4, 5, 5, 5]})
1381+
result = df.groupby(df.b)['a'].transform(max)
1382+
expected = pd.Series([1., 1., 2., 3., np.nan, 6., 6., 9., 9., 9.],
1383+
name='a')
1384+
assert_series_equal(result, expected)
1385+
13771386
def test_indices_concatenation_order(self):
13781387

13791388
# GH 2808

0 commit comments

Comments
 (0)