文本情感分析中的“复合”列如何排序

青葱年少 nlp 207

原文标题How do you sort the “compound” column in text sentiment analysis

在我的数据框中,我想按升序对复合列进行排序

代码:

df=pd.DataFrame(text_sentiment)
df.head()


text    date    compound    positive    negative    neutral
0   HOUSTON, March 25 (Reuters) - California diese...   2022-03-25T22:22:00Z    0.0000  0.000   0.000   1.000
1   March 31 (Reuters) - Major Russian oil refiner...   2022-03-31T09:01:00Z    -0.2960 0.053   0.109   0.838
2   Multiple US government agencies issued a joint...   2022-04-14T01:12:58Z    0.5859  0.274   0.137   0.590
3   HOUSTON (Reuters) - California diesel prices c...   2022-03-25T22:22:36Z    0.0000  0.000   0.000   1.000
4   THEGIFT777/E+ via Getty Images  2022-03-30T18:45:51Z    0.0000  0.000   0.000   1.000

原文链接:https://stackoverflow.com//questions/71917675/how-do-you-sort-the-compound-column-in-text-sentiment-analysis

回复

我来回复
  • new2coding的头像
    new2coding 评论

    df.sort_values(by=’compound’, 升序=False)

    2年前 0条评论