Skip to content

Commit f43abe5

Browse files
author
Gabriel Corona
committed
Don't fail when plotting Series/DataFrame with no row
When Series or DataFrames was empty (no cells) after removing columns without a suitable type (.select_dtypes), pandas was throwing a "no numeric data to plot" exception. This can happen: 1) either because there is no column with a suitable type; 2) or if there is no row. Raising an exception in the first case makes sense but we should probably avoid throwing an exception in the second case.
1 parent 03b3c8f commit f43abe5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/plotting/_matplotlib/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def _compute_plot_data(self):
418418
numeric_data = data.select_dtypes(include=include_type, exclude=exclude_type)
419419

420420
try:
421-
is_empty = numeric_data.empty
421+
is_empty = numeric_data.columns.empty
422422
except AttributeError:
423423
is_empty = not len(numeric_data)
424424

0 commit comments

Comments
 (0)