Skip to content

Commit 576f0a8

Browse files
committed
Better error message for DataFrame.hist() without numerical columns (pandas-dev#10444)
1 parent 5a286e4 commit 576f0a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/plotting/_core.py

+4
Original file line numberDiff line numberDiff line change
@@ -2426,6 +2426,10 @@ def hist_frame(data, column=None, by=None, grid=True, xlabelsize=None,
24262426
data = data._get_numeric_data()
24272427
naxes = len(data.columns)
24282428

2429+
if naxes == 0:
2430+
raise ValueError("hist method requires numerical columns, "
2431+
"nothing to plot.")
2432+
24292433
fig, axes = _subplots(naxes=naxes, ax=ax, squeeze=False,
24302434
sharex=sharex, sharey=sharey, figsize=figsize,
24312435
layout=layout)

0 commit comments

Comments
 (0)