相关疑难解决方法(0)

透视包含字符串的Pandas Dataframe - "没有要聚合的数字类型"错误

关于这个错误有很多问题,但在环顾四周之后,我仍然无法找到/解决问题.我正在尝试使用字符串来转动数据框,以使某些行数据成为列,但到目前为止还没有成功.

我的df的形状

<class 'pandas.core.frame.DataFrame'>
Int64Index: 515932 entries, 0 to 515931
Data columns (total 5 columns):
id                 515932 non-null object
cc_contact_id      515932 non-null object
Network_Name       515932 non-null object
question           515932 non-null object
response_answer    515932 non-null object
dtypes: object(5)
memory usage: 23.6+ MB
Run Code Online (Sandbox Code Playgroud)

样本格式

id  contact_id  question    response_answer
16  137519  2206    State   Ca
17  137520  2206    State   Ca
18  137521  2206    State   Ca
19  137522  2206    State   Ca
20  137523  2208    City    Lancaster
21  137524  2208    City    Lancaster
22  137525  2208    City …
Run Code Online (Sandbox Code Playgroud)

python pivot-table pandas

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

pandas ×1

pivot-table ×1

python ×1