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

Method test_apply_subset

pandas/tests/io/formats/style/test_style.py:672–683  ·  view source on GitHub ↗
(self, slice_, axis, df)

Source from the content-addressed store, hash-verified

670 )
671 @pytest.mark.parametrize("axis", [0, 1])
672 def test_apply_subset(self, slice_, axis, df):
673 def h(x, color="bar"):
674 return Series(f"color: {color}", index=x.index, name=x.name)
675
676 result = df.style.apply(h, axis=axis, subset=slice_, color="baz")._compute().ctx
677 expected = {
678 (r, c): [("color", "baz")]
679 for r, row in enumerate(df.index)
680 for c, col in enumerate(df.columns)
681 if row in df.loc[slice_].index and col in df.loc[slice_].columns
682 }
683 assert result == expected
684
685 @pytest.mark.parametrize(
686 "slice_",

Callers

nothing calls this directly

Calls 2

_computeMethod · 0.80
applyMethod · 0.45

Tested by

no test coverage detected