diff --git a/pandas/util/_decorators.py b/pandas/util/_decorators.py index 8fef3a231a748..571c065c53351 100644 --- a/pandas/util/_decorators.py +++ b/pandas/util/_decorators.py @@ -77,7 +77,7 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]: if alternative.__doc__: if alternative.__doc__.count("\n") < 3: raise AssertionError(doc_error_msg) - empty1, summary, empty2, doc = alternative.__doc__.split("\n", 3) + empty1, summary, empty2, doc_string = alternative.__doc__.split("\n", 3) if empty1 or empty2 and not summary: raise AssertionError(doc_error_msg) wrapper.__doc__ = dedent( @@ -87,7 +87,7 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]: .. deprecated:: {version} {msg} - {dedent(doc)}""" + {dedent(doc_string)}""" ) # error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], # Callable[...,Any]]", expected "Callable[[F], F]") diff --git a/pandas/util/_doctools.py b/pandas/util/_doctools.py index dc8a22b1fe0ef..6144d1a179828 100644 --- a/pandas/util/_doctools.py +++ b/pandas/util/_doctools.py @@ -167,7 +167,7 @@ def _make_table(self, ax, df, title: str, height: float | None = None) -> None: ax.axis("off") -if __name__ == "__main__": +def main() -> None: import matplotlib.pyplot as plt p = TablePlotter() @@ -188,8 +188,12 @@ def _make_table(self, ax, df, title: str, height: float | None = None) -> None: idx = pd.MultiIndex.from_tuples( [(1, "A"), (1, "B"), (1, "C"), (2, "A"), (2, "B"), (2, "C")] ) - col = pd.MultiIndex.from_tuples([(1, "A"), (1, "B")]) + column = pd.MultiIndex.from_tuples([(1, "A"), (1, "B")]) df3 = pd.DataFrame({"v1": [1, 2, 3, 4, 5, 6], "v2": [5, 6, 7, 8, 9, 10]}, index=idx) - df3.columns = col + df3.columns = column p.plot(df3, df3, labels=["df3"]) plt.show() + + +if __name__ == "__main__": + main()