Skip to content

Commit 5237ddf

Browse files
mjarosieMateusz Górski
authored and
Mateusz Górski
committed
ensure consistency between columns aggregates with missing values present (pandas-dev#29345)
1 parent 544aee2 commit 5237ddf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/frame/test_apply.py

+11
Original file line numberDiff line numberDiff line change
@@ -1359,3 +1359,14 @@ def test_apply_datetime_tz_issue(self):
13591359
expected = pd.Series(index=timestamps, data=timestamps)
13601360

13611361
tm.assert_series_equal(result, expected)
1362+
1363+
@pytest.mark.parametrize("df", [pd.DataFrame({"A": ["a", None], "B": ["c", "d"]})])
1364+
@pytest.mark.parametrize("method", ["min", "max", "sum"])
1365+
def test_consistency_of_aggregates_of_columns_with_missing_values(self, df, method):
1366+
# GH 16832
1367+
none_in_first_column_result = getattr(df[["A", "B"]], method)()
1368+
none_in_second_column_result = getattr(df[["B", "A"]], method)()
1369+
1370+
tm.assert_series_equal(
1371+
none_in_first_column_result, none_in_second_column_result
1372+
)

0 commit comments

Comments
 (0)