【发布时间】:2020-08-03 05:21:17
【问题描述】:
运行“无法分配给操作员”下方的代码时出现此错误
df_2 = pd.pivot_table(df, index = df.columns[~df.columns.str.startswith('A')],
values = df.columns[ df.columns.str.startswith('A')])
我想汇总所有不以 A 开头的列,并按照此处的建议将所有数据写入以 A 开头的列:
How to groupby and pivot a dataframe with non-numeric values
任何帮助将不胜感激。
【问题讨论】:
-
您介意添加mcve吗?
-
我让专注于手头的问题变得更加简单。可以吗?
-
你的意思是
df_2? -
我现在更正了。是的。只是给它起了另一个名字。
标签: python pandas pivot-table data-handling