Pandas 为什么simplemputer&x27;s fit_转换不适用于google colab中的数据帧?
当weather_测试是一个数据帧时,上面的代码在GoogleColab中抛出错误。 但当我将weather_test更改为numpy阵列时,它就起作用了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数组,而不是一个数据帧。有关如何在数据帧中使用
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))