有多少正評與負評?
在情感分析任務的第一步,和其他資料科學問題一樣,我們會想更深入地探索資料集。
你將使用一個 IMDB 電影評論的樣本。已為你建立名為 movies 的資料集。它是我們在投影片中看到的資料樣本。你可以在 IPython Shell 中自由探索,例如呼叫 .head() 方法。
請注意,本練習使用真實世界的資料,因此可能含有粗俗或其他冒犯性的內容(本練習以及之後任何同樣使用真實資料的練習皆然)。
本練習屬於課程
Python 情感分析
練習說明
- 找出
movies資料集中正評與負評的筆數。 - 找出資料集中正評與負評所佔的比例(百分比)。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Find the number of positive and negative reviews
print('Number of positive and negative reviews: ', movies.label.____)
# Find the proportion of positive and negative reviews
print('Proportion of positive and negative reviews: ', movies.label.____ / ____(movies))