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
This should either be all False, or throw with a better error message about "did you forget level"?
In [54]: midx = pd.MultiIndex.from_arrays([[1, 2, 3], ['a', 'b', 'c']], names = ('number', 'letter')) In [55]: midx.isin([1, 2]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-55-c96f0bd8505a> in <module>() ----> 1 midx.isin([1, 2]) ~/sandbox/pandas-ip/pandas/pandas/core/indexes/multi.py in isin(self, values, level) 2902 if level is None: 2903 values = MultiIndex.from_tuples(values, -> 2904 names=self.names).values 2905 return algos.isin(self.values, values) 2906 else: ~/sandbox/pandas-ip/pandas/pandas/core/indexes/multi.py in from_tuples(cls, tuples, sortorder, names) 1324 arrays = list(lib.tuples_to_object_array(tuples).T) 1325 elif isinstance(tuples, list): -> 1326 arrays = list(lib.to_object_array_tuples(tuples).T) 1327 else: 1328 arrays = lzip(*tuples) ~/sandbox/pandas-ip/pandas/pandas/_libs/src/inference.pyx in pandas._libs.lib.to_object_array_tuples() 1557 k = 0 1558 for i from 0 <= i < n: -> 1559 tmp = len(rows[i]) 1560 if tmp > k: 1561 k = tmp TypeError: object of type 'int' has no len() In [56]: midx = pd.MultiIndex.from_arrays([[1, 2, 3], ['a', 'b', 'c']], names = ('number', 'letter')) In [57]: midx.isin([1, 2]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-57-c96f0bd8505a> in <module>() ----> 1 midx.isin([1, 2]) ~/sandbox/pandas-ip/pandas/pandas/core/indexes/multi.py in isin(self, values, level) 2902 if level is None: 2903 values = MultiIndex.from_tuples(values, -> 2904 names=self.names).values 2905 return algos.isin(self.values, values) 2906 else: ~/sandbox/pandas-ip/pandas/pandas/core/indexes/multi.py in from_tuples(cls, tuples, sortorder, names) 1324 arrays = list(lib.tuples_to_object_array(tuples).T) 1325 elif isinstance(tuples, list): -> 1326 arrays = list(lib.to_object_array_tuples(tuples).T) 1327 else: 1328 arrays = lzip(*tuples) ~/sandbox/pandas-ip/pandas/pandas/_libs/src/inference.pyx in pandas._libs.lib.to_object_array_tuples() 1557 k = 0 1558 for i from 0 <= i < n: -> 1559 tmp = len(rows[i]) 1560 if tmp > k: 1561 k = tmp TypeError: object of type 'int' has no len()
In [58]: midx.isin([(1, 'a')]) Out[58]: array([ True, False, False], dtype=bool)
works fine.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This should either be all False, or throw with a better error message about "did you forget level"?
works fine.
The text was updated successfully, but these errors were encountered: