pandas的三个基本数据结构:Series 、DataFrame和Index。
可以这么理解,DataFrame像一张表,Series是指表里的某一行数据或某一列数据
那么当将某一列数据data[str]使用reshape()函数重调整时,就会报错,是因为Series数据类型没有reshape()函数 !
解决办法:
用values方法将Series对象转化成numpy的ndarray,再调用ndarray的reshape()函数。
data[str].values.reshape(arg1,arg2)
转载自:https://blog.youkuaiyun.com/qq_36448051/article/details/81592379
本文解析了Pandas中Series、DataFrame和Index的基本概念,强调DataFrame如同表格,Series则为行或列数据。针对Series使用reshape()函数的问题,提供了解决方案:先将Series转换为numpy的ndarray,再进行重塑。
1069

被折叠的 条评论
为什么被折叠?



