Skip to content

Commit 4a51628

Browse files
authored
TST: add regression test for DataFrame.mean(axis=1) with nullable Int64 dtype (GH#36585) (#62322)
1 parent 88affc3 commit 4a51628

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/frame/test_reductions.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,3 +2170,18 @@ def test_numeric_ea_axis_1(method, skipna, min_count, any_numeric_ea_dtype):
21702170
if method not in ("idxmax", "idxmin"):
21712171
expected = expected.astype(expected_dtype)
21722172
tm.assert_series_equal(result, expected)
2173+
2174+
2175+
def test_mean_nullable_int_axis_1():
2176+
# GH##36585
2177+
df = DataFrame(
2178+
{"a": [1, 2, 3, 4], "b": Series([1, 2, 4, None], dtype=pd.Int64Dtype())}
2179+
)
2180+
2181+
result = df.mean(axis=1, skipna=True)
2182+
expected = Series([1.0, 2.0, 3.5, 4.0], dtype="Float64")
2183+
tm.assert_series_equal(result, expected)
2184+
2185+
result = df.mean(axis=1, skipna=False)
2186+
expected = Series([1.0, 2.0, 3.5, pd.NA], dtype="Float64")
2187+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)