当我运行模型时,我不断收到以下值错误:
ValueError: Specifying the columns using strings is only supported for pandas DataFrames
这是错误的完整版本:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/sklearn/utils/__init__.py", line 425, in _get_column_indices
all_columns = X.columns
AttributeError: 'numpy.ndarray' object has no attribute 'columns'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/Python Practice/Working/Playstore/untitled0.py", line 48, in <module>
run.fit(x,y)
File "/usr/lib/python3.8/site-packages/sklearn/pipeline.py", line 330, in fit
Xt = self._fit(X, y, **fit_params_steps)
File "/usr/lib/python3.8/site-packages/sklearn/pipeline.py", line 292, in _fit
X, fitted_transformer = fit_transform_one_cached(
File "/usr/lib/python3.8/site-packages/joblib/memory.py", line 352, in __call__
return self.func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/sklearn/pipeline.py", line 740, in _fit_transform_one
res = transformer.fit_transform(X, y, **fit_params)
File "/usr/lib/python3.8/site-packages/sklearn/compose/_column_transformer.py", line 529, in fit_transform
self._validate_remainder(X)
File "/usr/lib/python3.8/site-packages/sklearn/compose/_column_transformer.py", line 327, in _validate_remainder
cols.extend(_get_column_indices(X, columns))
File "/usr/lib/python3.8/site-packages/sklearn/utils/__init__.py", line 427, in _get_column_indices
raise ValueError("Specifying the columns using strings is only "
ValueError: Specifying the columns using strings is only supported for pandas DataFrames
关于如何修复它有什么想法吗?如果您需要的话,可以在这里找到所使用的数据。最初,我尝试在单个变压器变量下一次性执行所有列转换,但这不起作用,建议我在再次运行之前将它们分开。我这样做了,但结果如你所见。我需要一些帮助。谢谢你!
Helenr
相关分类