-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Description
Here is a small example:
In [58]: df = pd.DataFrame(0., index=[0,1,2], columns=[0,1,'A','B']) df.filter(like='A') --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () 1 # BUG in pandas: cannot filter with like keyword if columns contain integers and string 2 df = pd.DataFrame(0., index=[0,1,2], columns=[0,1,'A','B']) ----> 3 df.filter(like='A') /snfs2/HOME/abie/ENV/lib/python2.7/site-packages/pandas-0.10.0.dev_85b4b11-py2.7-linux-x86_64.egg/pandas/core/frame.pyc in filter(self, items, like, regex) 2864 return self.reindex(columns=[r for r in items if r in self]) 2865 elif like: -> 2866 return self.select(lambda x: like in x, axis=1) 2867 elif regex: 2868 matcher = re.compile(regex) /snfs2/HOME/abie/ENV/lib/python2.7/site-packages/pandas-0.10.0.dev_85b4b11-py2.7-linux-x86_64.egg/pandas/core/generic.pyc in select(self, crit, axis) 318 319 if len(axis) > 0: --> 320 new_axis = axis[np.asarray([crit(label) for label in axis])] 321 else: 322 new_axis = axis /snfs2/HOME/abie/ENV/lib/python2.7/site-packages/pandas-0.10.0.dev_85b4b11-py2.7-linux-x86_64.egg/pandas/core/frame.pyc in (x) 2864 return self.reindex(columns=[r for r in items if r in self]) 2865 elif like: -> 2866 return self.select(lambda x: like in x, axis=1) 2867 elif regex: 2868 matcher = re.compile(regex) TypeError: argument of type 'int' is not iterable
This may have a simple solution, by making all of the labels into strings on line 320 of generic.py, I will investigate.