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

Function test_apply_multi_index

pandas/tests/apply/test_frame_apply.py:624–629  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

622
623
624def test_apply_multi_index():
625 index = MultiIndex.from_arrays([["a", "a", "b"], ["c", "d", "d"]])
626 s = DataFrame([[1, 2], [3, 4], [5, 6]], index=index, columns=["col1", "col2"])
627 result = s.apply(lambda x: Series({"min": min(x), "max": max(x)}), 1)
628 expected = DataFrame([[1, 2], [3, 4], [5, 6]], index=index, columns=["min", "max"])
629 tm.assert_frame_equal(result, expected, check_like=True)
630
631
632@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 6

applyMethod · 0.95
DataFrameClass · 0.90
SeriesClass · 0.90
minFunction · 0.85
maxFunction · 0.85
from_arraysMethod · 0.45

Tested by

no test coverage detected