Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ';numpy.ndarray和#x27;对象没有属性';isin';_Python - Fatal编程技术网

Python ';numpy.ndarray和#x27;对象没有属性';isin';

Python ';numpy.ndarray和#x27;对象没有属性';isin';,python,Python,我现在一直在做什么,因为我一直遇到这个错误。我一直在使用fct isin(), 但目前它不起作用: 代码: 输出错误: >>> [[10] [10] ... [ 9] [ 9]] >>>> Traceback (most recent call last): File "C:\Users\*temp.py", line 5, in <module> filtre = data[data['y'].isi

我现在一直在做什么,因为我一直遇到这个错误。我一直在使用fct isin(), 但目前它不起作用: 代码:

输出错误:

>>>
[[10]
 [10]
 ...
 [ 9]
 [ 9]]
>>>>
Traceback (most recent call last):
  File "C:\Users\*temp.py", line 5, in <module>
    filtre = data[data['y'].isin([9])]
AttributeError: 'numpy.ndarray' object has no attribute 'isin'
>
[[10]
[10]
...
[ 9]
[ 9]]
>>>>
回溯(最近一次呼叫最后一次):
文件“C:\Users\*temp.py”,第5行,在
filter=data[data['y'].isin([9])]
AttributeError:'numpy.ndarray'对象没有属性'isin'

我感谢所有能得到的帮助。非常感谢

当您尝试将
numpy isin
放入搜索引擎时发生了什么?或者复制并粘贴整个短语,
“numpy.ndarray”对象没有属性“isin”
?堆栈溢出不是为了替换现有的教程和文档。您到底想完成什么?
data
对象(由
loadmat()
方法返回)是一个字典,每个变量有一个键/值对。不能像屏蔽numpy数组(或pandas series/dataframe)一样将掩码应用于字典。
loadmat
返回字典。您是否希望它返回熊猫数据帧?
>>>
[[10]
 [10]
 ...
 [ 9]
 [ 9]]
>>>>
Traceback (most recent call last):
  File "C:\Users\*temp.py", line 5, in <module>
    filtre = data[data['y'].isin([9])]
AttributeError: 'numpy.ndarray' object has no attribute 'isin'