A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/12078 below:

Obscur AttributeError when dropping on a multi-index dataframe · Issue #12078 · pandas-dev/pandas · GitHub

In [2]:  df = pd.DataFrame(columns=['a','b','c','d'], data=[[1,'b1','c1',3], [1,'b2','c2',4]])

In [3]: df = df.pivot_table(index='a', columns=['b','c'], values='d').reset_index()

In [4]: df
Out[4]: 
b  a b1 b2
c    c1 c2
0  1  3  4

In [5]: df.drop('a', axis=1)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-b59fbf92d28f> in <module>()
----> 1 df.drop('a', axis=1)

/home/nicolas/Git/pandas/pandas/core/generic.pyc in drop(self, labels, axis, level, inplace, errors)
   1617                 new_axis = axis.drop(labels, level=level, errors=errors)
   1618             else:
-> 1619                 new_axis = axis.drop(labels, errors=errors)
   1620             dropped = self.reindex(**{axis_name: new_axis})
   1621             try:

/home/nicolas/Git/pandas/pandas/core/index.pyc in drop(self, labels, level, errors)
   5729                     inds.append(loc)
   5730                 else:
-> 5731                     inds.extend(lrange(loc.start, loc.stop))
   5732             except KeyError:
   5733                 if errors != 'ignore':

AttributeError: 'numpy.ndarray' object has no attribute 'start'

This is related to issue #11640. I have been working on a solution that I submitted in the pull request #11717, but the said solution was controversial, so I'm creating this issue to separate the problems.

I'll make a PR soon enough.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4