Highlight the minimum with a style. Parameters ---------- subset : label, array-like, IndexSlice, optional A valid 2d input to `DataFrame.loc[<subset>]`, or, in the case of a 1d input or single key, to `DataFrame.loc[:, <subset>]` where the c
(
self,
subset: Subset | None = None,
color: str = "yellow",
axis: Axis | None = 0,
props: str | None = None,
)
| 3644 | ) |
| 3645 | |
| 3646 | def highlight_min( |
| 3647 | self, |
| 3648 | subset: Subset | None = None, |
| 3649 | color: str = "yellow", |
| 3650 | axis: Axis | None = 0, |
| 3651 | props: str | None = None, |
| 3652 | ) -> Styler: |
| 3653 | """ |
| 3654 | Highlight the minimum with a style. |
| 3655 | |
| 3656 | Parameters |
| 3657 | ---------- |
| 3658 | subset : label, array-like, IndexSlice, optional |
| 3659 | A valid 2d input to `DataFrame.loc[<subset>]`, or, in the case of a 1d input |
| 3660 | or single key, to `DataFrame.loc[:, <subset>]` where the columns are |
| 3661 | prioritised, to limit ``data`` to *before* applying the function. |
| 3662 | color : str, default 'yellow' |
| 3663 | Background color to use for highlighting. |
| 3664 | axis : {0 or 'index', 1 or 'columns', None}, default 0 |
| 3665 | Apply to each column (``axis=0`` or ``'index'``), to each row |
| 3666 | (``axis=1`` or ``'columns'``), or to the entire DataFrame at once |
| 3667 | with ``axis=None``. |
| 3668 | props : str, default None |
| 3669 | CSS properties to use for highlighting. If ``props`` is given, ``color`` |
| 3670 | is not used. |
| 3671 | |
| 3672 | Returns |
| 3673 | ------- |
| 3674 | Styler |
| 3675 | Instance of class where min value is highlighted in given style. |
| 3676 | |
| 3677 | See Also |
| 3678 | -------- |
| 3679 | Styler.highlight_null: Highlight missing values with a style. |
| 3680 | Styler.highlight_max: Highlight the maximum with a style. |
| 3681 | Styler.highlight_between: Highlight a defined range with a style. |
| 3682 | Styler.highlight_quantile: Highlight values defined by a quantile with a style. |
| 3683 | |
| 3684 | Examples |
| 3685 | -------- |
| 3686 | >>> df = pd.DataFrame({"A": [2, 1], "B": [3, 4]}) |
| 3687 | >>> df.style.highlight_min(color="yellow") # doctest: +SKIP |
| 3688 | |
| 3689 | Please see: |
| 3690 | `Table Visualization <../../user_guide/style.ipynb>`_ for more examples. |
| 3691 | """ |
| 3692 | |
| 3693 | if props is None: |
| 3694 | props = f"background-color: {color};" |
| 3695 | return self.apply( |
| 3696 | partial(_highlight_value, op="min"), |
| 3697 | axis=axis, |
| 3698 | subset=subset, |
| 3699 | props=props, |
| 3700 | ) |
| 3701 | |
| 3702 | def highlight_between( |
| 3703 | self, |