AttributeError: 'numpy.ndarray' object has no attribute 'hilbert'
时间: 2023-08-04 21:09:09 浏览: 93
引用[1]:报错: AttributeError: ‘numpy.ndarray’ object has no attribute ‘columns 解决: 直接使用 a.tolist() 处理数据即可解决问题。 参考文章: python中list与array类型的查看与转换。引用[2]:==>> Sun Mar 6 18:24:10 2022 [Iter 1/8] loss = 7767.667969 ====>> Sun Mar 6 18:24:10 2022 Pass time: 0:00:17.678687 Traceback (most recent call last): File "C:\Program Files\pycharm\PyCharm Community Edition 2021.3.1\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\pycharm\PyCharm Community Edition 2021.3.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents "\n", file, 'exec'), glob, loc) File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 358, in <module> train(opt) File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 284, in train grd_x, grd_y = getGrd(img_in) File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 37, in getGrd grd_x = data_in.clone() AttributeError: 'numpy.ndarray' object has no attribute 'clone' 。引用[3]:源代码运行如下: from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler num_pipeline = Pipeline([ ('imputer',SimpleImputer(strategy="median")), ('attribs_adder',CombinedAttributesAdder()), ('std_scaler',StandardScaler) ]) housing_num_tr = num_pipeline.fit_transform(housing_num) 。
问题:AttributeError: 'numpy.ndarray' object has no attribute 'hilbert'
回答: 根据提供的引用内容,错误信息显示'numpy.ndarray'对象没有'hilbert'属性。这意味着在使用该属性时出现了错误。要解决此问题,您可以检查代码中是否正确导入了所需的模块,并确保您正在使用正确的属性名称。如果您确定代码正确,但仍然出现此错误,请检查您的数据是否正确加载并符合预期的格式。如果问题仍然存在,您可以尝试查找相关的文档或寻求专业人士的帮助来解决该问题。