Skip to content

Commit ecf449b

Browse files
Update _core.py to show valid plot types in the Error Message for Invalid plot kind (#55758)
* Update _core.py to show valid plot types in the Error Message for Invalid Plots If an invalid plot type is passed, the error message raised is ``` raise ValueError(f"{kind} is not a valid plot kind") ``` To give more context to user, it should also show the valid plot kinds. * Update _core.py with multiline exception message * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b0a0c68 commit ecf449b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/plotting/_core.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,10 @@ def __call__(self, *args, **kwargs):
961961
return plot_backend.plot(self._parent, x=x, y=y, kind=kind, **kwargs)
962962

963963
if kind not in self._all_kinds:
964-
raise ValueError(f"{kind} is not a valid plot kind")
964+
raise ValueError(
965+
f"{kind} is not a valid plot kind "
966+
f"Valid plot kinds: {self._all_kinds}"
967+
)
965968

966969
# The original data structured can be transformed before passed to the
967970
# backend. For example, for DataFrame is common to set the index as the

0 commit comments

Comments
 (0)