【发布时间】:2023-01-25 19:57:02
【问题描述】:
我有一个包含 topic 和 keywords 列的数据框,如下所示:
topic keyword
0 ['player', 'team', 'word_finder_unscrambler', ...
1 ['weather', 'forecast', 'sale', 'philadelphia'...
2 ['name', 'state', 'park', 'health', 'dog', 'ce...
3 ['game', 'flight', 'play', 'game_live', 'play_...
4 ['dictionary', 'clue', 'san_diego', 'professor...
需要分别为每个主题创建一个文本文件,即 topic1.txt、topic2.txt、....topic20.txt 并且主题文本文件应在关键字列内的换行符中包含字符串,如下所示:
topic1.txt file should contain:
player
team
word_finder_unscrambler
etc
【问题讨论】:
标签: python-3.x pandas dataframe