Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.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
Pandas 为什么simplemputer&x27;s fit_转换不适用于google colab中的数据帧?_Pandas_Scikit Learn_Google Colaboratory - Fatal编程技术网

Pandas 为什么simplemputer&x27;s fit_转换不适用于google colab中的数据帧?

Pandas 为什么simplemputer&x27;s fit_转换不适用于google colab中的数据帧?,pandas,scikit-learn,google-colaboratory,Pandas,Scikit Learn,Google Colaboratory,当weather_测试是一个数据帧时,上面的代码在GoogleColab中抛出错误。 但当我将weather_test更改为numpy阵列时,它就起作用了 imp = SimpleImputer(missing_values=np.nan, strategy='most_frequent') weather_test = imp.fit_transform(weather_test) Scikit learn的API方法通常假定输入是一个numpy数组,而不是一个数据帧。有关如何在数据帧中使用

当weather_测试是一个数据帧时,上面的代码在GoogleColab中抛出错误。 但当我将weather_test更改为numpy阵列时,它就起作用了

imp = SimpleImputer(missing_values=np.nan, strategy='most_frequent')
weather_test = imp.fit_transform(weather_test)

Scikit learn的API方法通常假定输入是一个numpy数组,而不是一个数据帧。有关如何在数据帧中使用此功能的示例,请参见

是否添加完整错误?
imp = SimpleImputer(missing_values=np.nan, strategy='most_frequent', verbose=0)
weather_test = imp.fit_transform(np.array(weather_test))