Skip to content

DOC: fix EX02 errors in docstrings #51529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
14 changes: 8 additions & 6 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]]))
Comment on lines +362 to +363
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the indentation looks a bit odd here, if you just run validate_docstrings on just this function, I think you might get an EX03 error about that? If so, could you better align it please? I think something like

        >>> df = pd.DataFrame([[1], [2]],
        ...                   index=pd.MultiIndex.from_product([[0], [1, 2]]))

should do

>>> descriptors = df.agg(["sum"])
>>> descriptors.index = pd.MultiIndex.from_product([[""], descriptors.index])
>>> df.style.concat(descriptors.style) # doctest: +SKIP
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down