Skip to content

Commit 107cb10

Browse files
Merge pull request #9417 from cel4/plot_error
improved error message for invalid chart types
2 parents c4a996a + f9031c2 commit 107cb10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/tools/plotting.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2272,15 +2272,16 @@ def _plot(data, x=None, y=None, subplots=False,
22722272
if kind in _all_kinds:
22732273
klass = _plot_klass[kind]
22742274
else:
2275-
raise ValueError('Invalid chart type given %s' % kind)
2275+
raise ValueError("%r is not a valid plot kind" % kind)
22762276

22772277
from pandas import DataFrame
22782278
if kind in _dataframe_kinds:
22792279
if isinstance(data, DataFrame):
22802280
plot_obj = klass(data, x=x, y=y, subplots=subplots, ax=ax,
22812281
kind=kind, **kwds)
22822282
else:
2283-
raise ValueError('Invalid chart type given %s' % kind)
2283+
raise ValueError("plot kind %r can only be used for data frames"
2284+
% kind)
22842285

22852286
elif kind in _series_kinds:
22862287
if isinstance(data, DataFrame):

0 commit comments

Comments
 (0)