Skip to content

Commit 1be6d08

Browse files
chrisjbillingtonwesm
authored andcommitted
Fixed regression with Panels caused by NDFrame not checking if it was DataFrame before assuming it had a 'columns' attribute.
1 parent b32165c commit 1be6d08

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/core/generic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def _clear_item_cache(self):
291291
self._item_cache.clear()
292292

293293
def _set_item(self, key, value):
294-
if isinstance(self.columns, MultiIndex):
294+
if hasattr(self,'columns') and isinstance(self.columns, MultiIndex):
295295
# Pad the key with empty strings if lower levels of the key
296296
# aren't specified:
297297
if not isinstance(key, tuple):
@@ -310,7 +310,9 @@ def __delitem__(self, key):
310310
Delete item
311311
"""
312312
deleted = False
313-
if isinstance(self.columns, MultiIndex) and key not in self.columns:
313+
if (hasattr(self,'columns') and
314+
isinstance(self.columns, MultiIndex)
315+
and key not in self.columns):
314316
# Allow shorthand to delete all columns whose first len(key)
315317
# elements match key:
316318
if not isinstance(key,tuple):

0 commit comments

Comments
 (0)