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
import pandas as pd idx = pd.MultiIndex.from_tuples([(0, i) for i in range(130)]) print idx.labels[1].dtype # --> int16 idx.set_labels(labels=idx.labels[1], level=1, inplace=True) print idx.labels[1].dtype # --> int8
Imho this is caused by the following line, because the erratic assumption that the indices of labels and self.levels would be index-aligned. https://github.com/pandas-dev/pandas/blame/master/pandas/core/indexes/multi.py#L331 Hence the call to coerce_indexer_dtype casts the given labels to int8. This is because its l'ooking at the number of categories in level 0.
labels
self.levels
coerce_indexer_dtype
I would suggest to replace
for l, lev, lab in zip(level, self.levels, labels): new_labels[l] = _ensure_frozen( lab, lev, copy=copy)._shallow_copy()
with
for l, lab in zip(level, labels): lev = self.levels[l] new_labels[l] = _ensure_frozen( lab, lev, copy=copy)._shallow_copy()
The text was updated successfully, but these errors were encountered:
Fix pandas-dev#19057
ee3204c
Successfully merging a pull request may close this issue.
Imho this is caused by the following line, because the erratic assumption that the indices of
labels
andself.levels
would be index-aligned.https://github.com/pandas-dev/pandas/blame/master/pandas/core/indexes/multi.py#L331
Hence the call to
coerce_indexer_dtype
casts the givenlabels
to int8. This is because its l'ooking at the number of categories in level 0.I would suggest to replace
with
The text was updated successfully, but these errors were encountered: