我有一个 Dataframe :
business049.txt [bmw, cash, fuel, mini, product, less, mini]
business470.txt [saudi, investor, pick, savoy, london, famou]
business075.txt [eu, minist, mull, jet, fuel, tax, european]
business101.txt [australia, rate, australia, rais, benchmark]
business060.txt [insur, boss, plead, guilti, anoth, us, insur]
因此,我希望输出包含一列单词和一列包含单词的文件名。
bmw [business049.txt,business055.txt]
australia [business101.txt,business141.txt]
谢谢你
1条答案
按热度按时间eeq64g8w1#
这很可能不是最有效/最佳的方法,但您可以这样做:
字典
word_dict
可能正是您所需要的,而不是仅仅为了使用DataFrame而保留DataFrame。如果是这种情况,请从字典创建中删除', '.join()
部分,因为dict的值在长度上不相等并不重要。