【发布时间】:2015-02-19 20:24:27
【问题描述】:
我是 pandas 的新手,正在尝试使用一些数据进行练习。我得到以下格式的训练数据集。
这是电影评论的数据集。如何从此类数据中制作 DataFrame 以用于 SVM 分类。我已经练习过使用 [12000*12] 大小的数据进行分类,其中每一行具有相同数量的属性。但是在这里,属性的长度不相等。我该如何修改。
PhraseId SentenceId Phrase Sentiment
1 1 Wanker Goths are on the loose ! 2
2 1 Wanker Goths 2
3 1 Wanker 2
4 1 Goths 2
5 1 are on the loose ! 2
6 1 are on the loose 2
7 1 on the loose 2
8 1 the loose 2
9 2 made Eddie Murphy a movie star and the man has n't aged a day . 3
10 2 made Eddie Murphy a movie star and the man 3
11 2 Eddie Murphy a movie star and the man 2
12 2 a movie star and the man 2
13 2 a movie star and 2
14 2 has n't aged a day . 2
15 2 has n't aged a day 3
16 2 aged a day 2
这是实际训练dataset(部分)。
我的目标是用数字数据映射从这个 Dataset 形成一个 DataFrame,以便我可以使用该 DataFrame 对 Sentiment 进行分类。
【问题讨论】:
-
我知道 pandas 有一个 get_dummies() 但我从未在文本分类问题中使用过它
标签: python pandas dataframe svm sentiment-analysis