We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pd.Timestamp is one of types that don't pass np.isscalar test previously used in _cat_compare_op, pd.lib.isscalar should be used instead.
pd.Timestamp
np.isscalar
pd.lib.isscalar
In [1]: cat = pd.Categorical(pd.date_range('2014', periods=5)) In [2]: cat > cat[0] -- TypeError Traceback (most recent call last) <ipython-input-2-77883e4783fe> in <module>() --> 1 cat > cat[0] /home/dshpektorov/sources/pandas/pandas/core/categorical.py in f(self, other) 52 msg = "Cannot compare a Categorical for op {op} with type {typ}. If you want to \n" \ 53 "compare values, use 'np.asarray(cat) <op> other'." --> 54 raise TypeError(msg.format(op=op,typ=type(other))) 55 56 f.__name__ = op TypeError: Cannot compare a Categorical for op __gt__ with type <class 'pandas.tslib.Timestamp'>. If you want to compare values, use 'np.asarray(cat) <op> other'.
Sorry, something went wrong.
can u add a simple doc note ref this pr
Ah, indeed, I've forgotten about that.
BUG: fix Categorical comparison to work with datetime
9ce9378
pd.Timestamp is one of types that don't pass np.isscalar test, that was previously used in _cat_compare_op. pd.lib.isscalar should be used instead.
8d088b3
thanks!
Successfully merging this pull request may close these issues.