Python remove stop words from pandas dataframe

后端 未结 4 1345
走了就别回头了
走了就别回头了 2020-11-29 02:08

I want to remove the stop words from my column \"tweets\". How do I iterative over each row and each item?

pos_tweets = [(\'I love this car\', \'positive\'),         


        
4条回答
  •  死守一世寂寞
    2020-11-29 03:07

    Using List Comprehension

    test['tweet'].apply(lambda x: [item for item in x if item not in stop])
    

    Returns:

    0               [love, car]
    1           [view, amazing]
    2    [feel, great, morning]
    3        [excited, concert]
    4            [best, friend]
    

提交回复
热议问题