Skip to content

Commit f9031c2

Browse files
committed
improved error messages for invalid chart types
1 parent 4aa0e0a commit f9031c2

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
@@ -2266,15 +2266,16 @@ def _plot(data, x=None, y=None, subplots=False,
22662266
if kind in _all_kinds:
22672267
klass = _plot_klass[kind]
22682268
else:
2269-
raise ValueError('Invalid chart type given %s' % kind)
2269+
raise ValueError("%r is not a valid plot kind" % kind)
22702270

22712271
from pandas import DataFrame
22722272
if kind in _dataframe_kinds:
22732273
if isinstance(data, DataFrame):
22742274
plot_obj = klass(data, x=x, y=y, subplots=subplots, ax=ax,
22752275
kind=kind, **kwds)
22762276
else:
2277-
raise ValueError('Invalid chart type given %s' % kind)
2277+
raise ValueError("plot kind %r can only be used for data frames"
2278+
% kind)
22782279

22792280
elif kind in _series_kinds:
22802281
if isinstance(data, DataFrame):

0 commit comments

Comments
 (0)