Skip to content

Commit 8bcf581

Browse files
committed
BUG: non-unique column index was failing in construction if from an ndarray
ENH: non-unique assignment now works TST: more tests BUG: handle multi-level columns correctly (original method) CLN/BUG: raise exception if block ref_locs are not set when _set_ref_locs
1 parent 0bac57f commit 8bcf581

File tree

4 files changed

+206
-100
lines changed

4 files changed

+206
-100
lines changed

pandas/core/frame.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,11 @@ def __getitem__(self, key):
20032003
return self._getitem_multilevel(key)
20042004
else:
20052005
# get column
2006-
return self._get_item_cache(key)
2006+
if self.columns.is_unique:
2007+
return self._get_item_cache(key)
2008+
2009+
# duplicate columns
2010+
return self._constructor(self._data.get(key))
20072011

20082012
def _getitem_slice(self, key):
20092013
return self._slice(key, axis=0)

0 commit comments

Comments
 (0)