AttributeError: 'Series' object has no attribute 'reshape'

分手后的思念是犯贱 2022-03-25 11:20 564阅读 0赞

AttributeError: ‘Series’ object has no attribute ‘reshape’

Series数据类型没有reshape函数
解决办法:
用values方法将Series对象转化成numpy的ndarray,再用ndarray的reshape方法.
data[‘Amount’].values.reshape(-1, 1)

另外:pandas有两种对象:Series 和DataFrame。
可以这么理解,DataFrame像一张表,Series是指表里的某一行数据或某一列数据

发表评论

表情:
评论列表 (有 0 条评论,564人围观)

还没有评论,来说两句吧...

相关阅读