Reshape your data either using array.reshape(-1, 1)

对数据进行标准化处理的时候出现以下错误提示:

Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

数据如下:

Reshape your data either using array.reshape(-1, 1)_第1张图片

错误提示:

​​​​​​

Reshape your data either using array.reshape(-1, 1)_第2张图片

问题原因:X值类型错误

fit_transform() 要求输入参数X为numpy arry类型

Reshape your data either using array.reshape(-1, 1)_第3张图片

但是直接从data获取的X类型为,故需要做类型转换将Series类型转换成arry类型

Reshape your data either using array.reshape(-1, 1)_第4张图片

此时X、Y类型为,即刻

你可能感兴趣的:(Reshape your data either using array.reshape(-1, 1))