You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/usr/lib64/python3.4/site-packages/pandas/core/groupby.py", line 106, in f
self._set_selection_from_grouper()
File "/usr/lib64/python3.4/site-packages/pandas/core/groupby.py", line 489, in _set_selection_from_grouper
self._group_selection = ax.difference(Index(groupers)).tolist()
File "/usr/lib64/python3.4/site-packages/pandas/core/index.py", line 1506, in difference
theDiff = sorted(set(self) - set(other))
File "pandas/tslib.pyx", line 836, in pandas.tslib._Timestamp.__richcmp__ (pandas/tslib.c:15612)
TypeError: Cannot compare type 'Timestamp' with type 'str'
The text was updated successfully, but these errors were encountered:
So the issue is below, its an Index set operation.
In [17]: Index([u'aaaa', Timestamp('2012-01-01 00:00:00'), Timestamp('2012-01-02 00:00:00'), u'name'], dtype='object').sort_values()
TypeError: Cannot compare type 'Timestamp' with type 'unicode'
You realize that this is a completely useless index. You should really not do this, mixing objects and strings.
I'll mark it as a bug, but not a high priority.
jreback
changed the title
TypeError while doing groupby() on DataFrame with Timestamp and str columns
BUG: index sorting with strings & timestamps
Oct 5, 2015
The original issue looks to work on master. Could use a test.
In [31]: test.groupby('name').first()
Out[31]:
2012-01-01 00:00:00 2012-01-02 00:00:00 aaaa
name
e a c f
In [32]: pd.__version__
Out[32]: '0.26.0.dev0+652.g30362ed82'
Pandas 0.16.2, Python 3.4.
Fails with:
The text was updated successfully, but these errors were encountered: