From 1d88e84727df27bd25f1ae961983dadb59a1f71a Mon Sep 17 00:00:00 2001 From: savinserhii <70030869+savinserhii@users.noreply.github.com> Date: Sat, 8 Mar 2025 19:23:07 -0500 Subject: [PATCH 1/3] Update hist.py From a173426a690d8ff83a1f5ddf543aed1620c39160 Mon Sep 17 00:00:00 2001 From: savinserhii <70030869+savinserhii@users.noreply.github.com> Date: Sun, 9 Mar 2025 00:37:57 +0000 Subject: [PATCH 2/3] BUG: Fix Incompatible argument type for set_xlabel and set_ylabel. --- pandas/plotting/_matplotlib/hist.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pandas/plotting/_matplotlib/hist.py b/pandas/plotting/_matplotlib/hist.py index 1a423ad49c294..d58b39fa4cea4 100644 --- a/pandas/plotting/_matplotlib/hist.py +++ b/pandas/plotting/_matplotlib/hist.py @@ -201,16 +201,18 @@ def _get_column_weights(weights, i: int, y): def _post_plot_logic(self, ax: Axes, data) -> None: if self.orientation == "horizontal": - # error: Argument 1 to "set_xlabel" of "_AxesBase" has incompatible - # type "Hashable"; expected "str" ax.set_xlabel( - "Frequency" if self.xlabel is None else self.xlabel # type: ignore[arg-type] + "Frequency" if self.xlabel is None else str(self.xlabel) # type: ignore[arg-type] + ) + ax.set_ylabel( + self.ylabel if isinstance(self.ylabel, str) else str(self.ylabel) # type: ignore[arg-type] ) - ax.set_ylabel(self.ylabel) # type: ignore[arg-type] else: - ax.set_xlabel(self.xlabel) # type: ignore[arg-type] + ax.set_xlabel( + self.xlabel if isinstance(self.xlabel, str) else str(self.xlabel) # type: ignore[arg-type] + ) ax.set_ylabel( - "Frequency" if self.ylabel is None else self.ylabel # type: ignore[arg-type] + "Frequency" if self.ylabel is None else ylabel # type: ignore[arg-type] ) @property From f1e0e2a425bad608661418251809830494207dfb Mon Sep 17 00:00:00 2001 From: savinserhii <70030869+savinserhii@users.noreply.github.com> Date: Sun, 9 Mar 2025 00:39:15 +0000 Subject: [PATCH 3/3] BUG: Fix Incompatible argument type for set_xlabel and set_ylabel. --- pandas/plotting/_matplotlib/hist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/plotting/_matplotlib/hist.py b/pandas/plotting/_matplotlib/hist.py index d58b39fa4cea4..49302d9bf0494 100644 --- a/pandas/plotting/_matplotlib/hist.py +++ b/pandas/plotting/_matplotlib/hist.py @@ -212,7 +212,7 @@ def _post_plot_logic(self, ax: Axes, data) -> None: self.xlabel if isinstance(self.xlabel, str) else str(self.xlabel) # type: ignore[arg-type] ) ax.set_ylabel( - "Frequency" if self.ylabel is None else ylabel # type: ignore[arg-type] + "Frequency" if self.ylabel is None else self.ylabel # type: ignore[arg-type] ) @property