使用python

我真的是python新手。我试图以特殊的方式解析我的数据集。

所以,我有一个.csv文件,例如

使用python

应该像

使用python

我使用该代码块来解析单词;

dataset = pandas.read_csv('/root/Desktop/%20/%1004.csv',encoding='cp1252')


for line in dataset['text']:
    words = line.split()
    for word in words:

        tokenize = word_tokenize(word.translate(table))
        stopwords= [w for w in tokenize if not w in stop_words]
        punc = [token for token in stopwords if not all(char.isdigit() or char == '.' or char == '-' for char in token)]
        lemmatized_word = [wordnet_lemmatizer.lemmatize(word) for word in punc]
        stemmed_word = [snowball_stemmer.stem(word) for word in lemmatized_word]
        print(stemmed_word)

我的输出:

使用python

我的数据集样本:

使用python

那么,如何如上所述解析我的数据集?以及如何将它们写入csv文件?

重复的主题实际上不是我的问题的答案。谈论下降。

tarenamis 回答:使用python

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3137919.html

大家都在问