【发布时间】:2021-02-18 23:33:52
【问题描述】:
我正在尝试将两列转换为字典,一列是类别,另一列是评论。
| category | comment |
|---|---|
| complain | did not like his attention |
| complain | I would never use this again |
| congrats | you are the best |
| request | I need my papers |
想法是将其转换为按类别分组的字典,我的意思是这样的
Diccionario= {
"complain":[
'did not like his attention',
'I would never use this again'
],
"congrats":[
'you are the best'
],
"request":[
'I need my papers'
],
}
谢谢
【问题讨论】:
标签: python pandas dataframe dictionary