We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In [13]: pd.MultiIndex.from_arrays([[], []]) Out[13]: MultiIndex(levels=[[], []], labels=[[], []]) In [14]: pd.MultiIndex.from_arrays([[], []]).unique() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-14-d5be3b23b8c3> in <module>() ----> 1 pd.MultiIndex.from_arrays([[], []]).unique() ~/pandas/pandas/core/indexes/multi.py in unique(self, level) 1071 1072 if level is None: -> 1073 return super(MultiIndex, self).unique() 1074 else: 1075 level = self._get_level_number(level) ~/pandas/pandas/core/indexes/base.py in unique(self, level) 4366 self._validate_index_level(level) 4367 result = super(Index, self).unique() -> 4368 return self._shallow_copy(result) 4369 4370 def drop_duplicates(self, keep='first'): ~/pandas/pandas/core/indexes/multi.py in _shallow_copy(self, values, **kwargs) 558 # discards freq 559 kwargs.pop('freq', None) --> 560 return MultiIndex.from_tuples(values, **kwargs) 561 return self.view() 562 ~/pandas/pandas/core/indexes/multi.py in from_tuples(cls, tuples, sortorder, names) 1315 if names is None: 1316 msg = 'Cannot infer number of levels from empty list' -> 1317 raise TypeError(msg) 1318 arrays = [[]] * len(names) 1319 elif isinstance(tuples, (np.ndarray, Index)): TypeError: Cannot infer number of levels from empty list
The text was updated successfully, but these errors were encountered:
xref #20544 (comment)
cc @WillAyd @toobaz
Sorry, something went wrong.
Duplicate of #20308
BUG: .unique() on MultiIndex: preserve names
6f91db6
closes pandas-dev#20568
7bf5d3a
closes pandas-dev#20568 closes pandas-dev#20570
No branches or pull requests
The text was updated successfully, but these errors were encountered: