data=pd.read_csv('xxx.csv',encoding='gbk')
new_data=pd.pivot_table(data,values='时间序列',index='姓名')
运行后报如下错误:https://ask.csdn.net/my#
for i in values:
if i in values :
if i not in data:
raise keyError(i)
TypeError:argument of type 'method' is not iterable.
是因为透明表的值域不能是时间序列吗?还是想要处理的数据没有存入透明表中?
pivot_table默认对values的操作是求和取平均,你的values是时间序列,可能为2018/5/21等,是不能求和的。所以会运行错误。
你可以试一下啊用全是数值的列,如number列为1,2,3,4,5等,然后values='number',就没有这个错误了
values?应该是for i in new_data吧。因为你的value不是集合或者列表只是一个字符串,叫做'时间序列'
TypeError:argument of type 'method' is not iterable. 说明你取错值了,你取的值是不可循环的,一楼的回答是对的。