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

Function test_apply_differently_indexed

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

Source from the content-addressed store, hash-verified

492
493
494def test_apply_differently_indexed():
495 df = DataFrame(np.random.default_rng(2).standard_normal((20, 10)))
496
497 result = df.apply(Series.describe, axis=0)
498 expected = DataFrame({i: v.describe() for i, v in df.items()}, columns=df.columns)
499 tm.assert_frame_equal(result, expected)
500
501 result = df.apply(Series.describe, axis=1)
502 expected = DataFrame({i: v.describe() for i, v in df.T.items()}, columns=df.index).T
503 tm.assert_frame_equal(result, expected)
504
505
506def test_apply_bug():

Callers

nothing calls this directly

Calls 5

applyMethod · 0.95
itemsMethod · 0.95
DataFrameClass · 0.90
describeMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected