Skip to content

Commit

Permalink
Update _core.py to show valid plot types in the Error Message for Inv…
Browse files Browse the repository at this point in the history
…alid 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.
  • Loading branch information
ahmadmustafaanis authored Oct 30, 2023
1 parent a39f783 commit 5692a40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ def __call__(self, *args, **kwargs):
return plot_backend.plot(self._parent, x=x, y=y, kind=kind, **kwargs)

if kind not in self._all_kinds:
raise ValueError(f"{kind} is not a valid plot kind")
raise ValueError(f"{kind} is not a valid plot kind\nValid plot kinds {self._all_kinds}")

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

0 comments on commit 5692a40

Please sign in to comment.