From 8264a120d0025a2188f0bcb61faf7c0c26cc2643 Mon Sep 17 00:00:00 2001 From: Aman Thakral Date: Tue, 18 Oct 2011 16:41:02 -0400 Subject: [PATCH] Fixed issue with plotting a column with all null values. --- pandas/core/frame.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 476bcd7da8d91..e463d6361a6f5 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2860,12 +2860,14 @@ def plot(self, subplots=False, sharex=True, sharey=False, use_index=True, x = range(len(self)) for i, col in enumerate(_try_sort(self.columns)): + empty = np.all(np.isnan(self[col].values)) + y = self[col].values if not empty else np.zeros(x.shape) if subplots: ax = axes[i] - ax.plot(x, self[col].values, 'k', label=col, **kwds) + ax.plot(x, y, 'k', label=col, **kwds) ax.legend(loc='best') else: - ax.plot(x, self[col].values, label=col, **kwds) + ax.plot(x, y, label=col, **kwds) ax.grid(grid)