MCPcopy
hub / github.com/pandas-dev/pandas / test_groupby_rolling_sem

Method test_groupby_rolling_sem

pandas/tests/window/test_groupby.py:686–700  ·  view source on GitHub ↗
(self, func, kwargs, expected_values)

Source from the content-addressed store, hash-verified

684 ],
685 )
686 def test_groupby_rolling_sem(self, func, kwargs, expected_values):
687 # GH: 26476
688 df = DataFrame(
689 [["a", 1], ["a", 2], ["b", 1], ["b", 2], ["b", 3]], columns=["a", "b"]
690 )
691 result = getattr(df.groupby("a"), func)(**kwargs).sem()
692 expected = DataFrame(
693 {"a": [np.nan] * 5, "b": expected_values},
694 index=MultiIndex.from_tuples(
695 [("a", 0), ("a", 1), ("b", 2), ("b", 3), ("b", 4)], names=["a", None]
696 ),
697 )
698 # GH 32262
699 expected = expected.drop(columns="a")
700 tm.assert_frame_equal(result, expected)
701
702 @pytest.mark.parametrize(
703 ("rollings", "key"), [({"on": "a"}, "a"), ({"on": None}, "index")]

Callers

nothing calls this directly

Calls 5

groupbyMethod · 0.95
dropMethod · 0.95
DataFrameClass · 0.90
semMethod · 0.45
from_tuplesMethod · 0.45

Tested by

no test coverage detected