Skip to content

Commit 8264a12

Browse files
committed
Fixed issue with plotting a column with all null values.
1 parent c375fa3 commit 8264a12

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/core/frame.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2860,12 +2860,14 @@ def plot(self, subplots=False, sharex=True, sharey=False, use_index=True,
28602860
x = range(len(self))
28612861

28622862
for i, col in enumerate(_try_sort(self.columns)):
2863+
empty = np.all(np.isnan(self[col].values))
2864+
y = self[col].values if not empty else np.zeros(x.shape)
28632865
if subplots:
28642866
ax = axes[i]
2865-
ax.plot(x, self[col].values, 'k', label=col, **kwds)
2867+
ax.plot(x, y, 'k', label=col, **kwds)
28662868
ax.legend(loc='best')
28672869
else:
2868-
ax.plot(x, self[col].values, label=col, **kwds)
2870+
ax.plot(x, y, label=col, **kwds)
28692871

28702872
ax.grid(grid)
28712873

0 commit comments

Comments
 (0)