Skip to content

Commit 2671bd9

Browse files
crepererumproost
authored andcommitted
TST: add regression test for all-none-groupby (pandas-dev#29067)
Closes pandas-dev#21624
1 parent 21b9db0 commit 2671bd9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/groupby/test_groupby.py

+10
Original file line numberDiff line numberDiff line change
@@ -1944,3 +1944,13 @@ def test_shift_bfill_ffill_tz(tz_naive_fixture, op, expected):
19441944
result = getattr(grouped, op)()
19451945
expected = DataFrame(expected).assign(time=lambda x: x.time.dt.tz_localize(tz))
19461946
assert_frame_equal(result, expected)
1947+
1948+
1949+
def test_groupby_only_none_group():
1950+
# see GH21624
1951+
# this was crashing with "ValueError: Length of passed values is 1, index implies 0"
1952+
df = pd.DataFrame({"g": [None], "x": 1})
1953+
actual = df.groupby("g")["x"].transform("sum")
1954+
expected = pd.Series([np.nan], name="x")
1955+
1956+
assert_series_equal(actual, expected)

0 commit comments

Comments
 (0)