From f1e14f1aa8deb7a4c6c8ef7822d1759327596541 Mon Sep 17 00:00:00 2001 From: Natalia Mokeeva Date: Tue, 21 Feb 2023 00:02:10 +0100 Subject: [PATCH] DOC: fix EX02 errors in docstrings --- ci/code_checks.sh | 4 ---- pandas/io/formats/style.py | 14 ++++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 0333975ed269f..0803569a12ae0 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -584,10 +584,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.api.types.is_sparse \ pandas.api.types.is_string_dtype \ pandas.api.types.is_unsigned_integer_dtype \ - pandas.io.formats.style.Styler.concat \ - pandas.io.formats.style.Styler.export \ - pandas.io.formats.style.Styler.set_td_classes \ - pandas.io.formats.style.Styler.use \ pandas.plotting.andrews_curves \ pandas.plotting.autocorrelation_plot \ pandas.plotting.lag_plot \ diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 25ba4b697d97b..bc33b8d8716b7 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -332,7 +332,7 @@ def concat(self, other: Styler) -> Styler: A common use case is adding totals rows, or otherwise, via methods calculated in ``DataFrame.agg``. - >>> df = DataFrame([[4, 6], [1, 9], [3, 4], [5, 5], [9,6]], + >>> df = pd.DataFrame([[4, 6], [1, 9], [3, 4], [5, 5], [9,6]], ... columns=["Mike", "Jim"], ... index=["Mon", "Tue", "Wed", "Thurs", "Fri"]) >>> styler = df.style.concat(df.agg(["sum"]).style) # doctest: +SKIP @@ -359,7 +359,8 @@ def concat(self, other: Styler) -> Styler: When ``other`` has fewer index levels than the original Styler it is possible to extend the index in ``other``, with placeholder levels. - >>> df = DataFrame([[1], [2]], index=pd.MultiIndex.from_product([[0], [1, 2]])) + >>> df = pd.DataFrame([[1], [2]], + ... index=pd.MultiIndex.from_product([[0], [1, 2]])) >>> descriptors = df.agg(["sum"]) >>> descriptors.index = pd.MultiIndex.from_product([[""], descriptors.index]) >>> df.style.concat(descriptors.style) # doctest: +SKIP @@ -1463,6 +1464,7 @@ def set_td_classes(self, classes: DataFrame) -> Styler: Form of the output with new additional css classes, + >>> from pandas.io.formats.style import Styler >>> df = pd.DataFrame([[1]]) >>> css = pd.DataFrame([["other-class"]]) >>> s = Styler(df, uuid="_", cell_ids=False).set_td_classes(css) @@ -2067,8 +2069,8 @@ def export(self) -> dict[str, Any]: Examples -------- - >>> styler = DataFrame([[1, 2], [3, 4]]).style - >>> styler2 = DataFrame([[9, 9, 9]]).style + >>> styler = pd.DataFrame([[1, 2], [3, 4]]).style + >>> styler2 = pd.DataFrame([[9, 9, 9]]).style >>> styler.hide(axis=0).highlight_max(axis=1) # doctest: +SKIP >>> export = styler.export() >>> styler2.use(export) # doctest: +SKIP @@ -2119,8 +2121,8 @@ def use(self, styles: dict[str, Any]) -> Styler: Examples -------- - >>> styler = DataFrame([[1, 2], [3, 4]]).style - >>> styler2 = DataFrame([[9, 9, 9]]).style + >>> styler = pd.DataFrame([[1, 2], [3, 4]]).style + >>> styler2 = pd.DataFrame([[9, 9, 9]]).style >>> styler.hide(axis=0).highlight_max(axis=1) # doctest: +SKIP >>> export = styler.export() >>> styler2.use(export) # doctest: +SKIP