【发布时间】:2022-01-18 07:13:24
【问题描述】:
如下所述,我在 pandas 中有一个数据框,其中 info 列中的元素与 id 列中的唯一文件相同:
id text info
1 great boy,police
1 excellent boy,police
2 nice girl,mother,teacher
2 good girl,mother,teacher
2 bad girl,mother,teacher
3 awesome grandmother
4 superb grandson
我只想将列表元素作为每个文件的行,例如:
id text info
1 great boy
1 excellent police
2 nice girl
2 good mother
2 bad teacher
3 awesome grandmother
4 superb grandson
【问题讨论】:
标签: python-3.x pandas dataframe