-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: fix assert_categorical_equal message #13080
New issue
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
Conversation
35f1a53
to
1a5cc27
Compare
assert_index_equal(res.categories, exp.categories) | ||
assert_index_equal(left.categories, right.categories, | ||
obj='{0}.categories'.format(obj)) | ||
assert_numpy_array_equal(left.codes, right.codes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In [2]: tm.assert_numpy_array_equal(np.array([1,2],dtype='int64'),np.array([1,2],dtype='int8'))
Out[2]: True
check the dtypes are equal as well (in fact we might want to do that in assert_numpy_array_equal
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will split this to other PR as there are lots of failures (unrelated to categorical).
ef83608
to
ee0f652
Compare
6f48d79
to
91ccb3c
Compare
91ccb3c
to
81172ce
Compare
@@ -985,7 +985,7 @@ def __setstate__(self, state): | |||
|
|||
# Provide compatibility with pre-0.15.0 Categoricals. | |||
if '_codes' not in state and 'labels' in state: | |||
state['_codes'] = state.pop('labels') | |||
state['_codes'] = state.pop('labels').astype(np.int8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor fix to make dtype
compat. Needs whatsnew?
ty sir! |
follow up for #13080 to use `_coerce_indexer_dtype`. Author: sinhrks <[email protected]> Closes #13426 from sinhrks/cat_pickle and squashes the following commits: e8702f8 [sinhrks] BUG: categorical unpickle to use _coerce_indexer_dtype
git diff upstream/master | flake8 --diff
This must be after #13088.