失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > pandas - AttributeError: Series object has no attribute reshape

pandas - AttributeError: Series object has no attribute reshape

时间:2022-06-14 18:34:38

相关推荐

pandas - AttributeError: Series object has no attribute reshape

Series数据类型没有reshape函数

解决办法:

1.用values方法将Series对象转化成numpy的ndarray,再用ndarray的reshape方法.

lael = label.values.reshape(-1,1)

2.直接转换成array

label = np.array(label)label = label.reshape(-1,1)

如果觉得《pandas - AttributeError: Series object has no attribute reshape》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。