【发布时间】:2021-02-24 13:54:35
【问题描述】:
我有一个数据集,格式为我有一个句子,对于每个句子,我都有该句子中每个相关单词的 tf-idf 值。
Sample dataset:
heel syrup word3 word4 word5
So what is a better exercise 0 0 0 0 0.34
how many days hv to take syrup 0 0.95 0 0 0
Can I take this solution ? 0 0 0 0 0.23
数据集非常庞大,大约有 10K 行是句子,5K 列是单词。 从这里我想创建一个新列,并为每个句子保留 tf-idf 值大于 0.6 的单词。 实现的代码是:
dataset = pd.read_csv(r'Desktop/tfidf_val.csv')
dataset.apply(lambda x: x.index[x.astype(bool)].tolist(), 1)
但我遇到了内存错误。知道如何解决这个问题或者代码是否存在问题
【问题讨论】:
标签: python pandas nlp out-of-memory tf-idf