|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "import pandas as pd" |
| 10 | + ] |
| 11 | + }, |
| 12 | + { |
| 13 | + "cell_type": "code", |
| 14 | + "execution_count": 18, |
| 15 | + "metadata": {}, |
| 16 | + "outputs": [], |
| 17 | + "source": [ |
| 18 | + "data = pd.read_csv('data/imdb-reviews/dataset.csv', encoding='latin-1')" |
| 19 | + ] |
| 20 | + }, |
| 21 | + { |
| 22 | + "cell_type": "code", |
| 23 | + "execution_count": 19, |
| 24 | + "metadata": {}, |
| 25 | + "outputs": [ |
| 26 | + { |
| 27 | + "name": "stdout", |
| 28 | + "output_type": "stream", |
| 29 | + "text": [ |
| 30 | + "<class 'pandas.core.frame.DataFrame'>\n", |
| 31 | + "RangeIndex: 25000 entries, 0 to 24999\n", |
| 32 | + "Data columns (total 2 columns):\n", |
| 33 | + "SentimentText 25000 non-null object\n", |
| 34 | + "Sentiment 25000 non-null int64\n", |
| 35 | + "dtypes: int64(1), object(1)\n", |
| 36 | + "memory usage: 390.7+ KB\n" |
| 37 | + ] |
| 38 | + } |
| 39 | + ], |
| 40 | + "source": [ |
| 41 | + "data.info()" |
| 42 | + ] |
| 43 | + }, |
| 44 | + { |
| 45 | + "cell_type": "code", |
| 46 | + "execution_count": 20, |
| 47 | + "metadata": {}, |
| 48 | + "outputs": [ |
| 49 | + { |
| 50 | + "data": { |
| 51 | + "text/html": [ |
| 52 | + "<div>\n", |
| 53 | + "<style scoped>\n", |
| 54 | + " .dataframe tbody tr th:only-of-type {\n", |
| 55 | + " vertical-align: middle;\n", |
| 56 | + " }\n", |
| 57 | + "\n", |
| 58 | + " .dataframe tbody tr th {\n", |
| 59 | + " vertical-align: top;\n", |
| 60 | + " }\n", |
| 61 | + "\n", |
| 62 | + " .dataframe thead th {\n", |
| 63 | + " text-align: right;\n", |
| 64 | + " }\n", |
| 65 | + "</style>\n", |
| 66 | + "<table border=\"1\" class=\"dataframe\">\n", |
| 67 | + " <thead>\n", |
| 68 | + " <tr style=\"text-align: right;\">\n", |
| 69 | + " <th></th>\n", |
| 70 | + " <th>SentimentText</th>\n", |
| 71 | + " <th>Sentiment</th>\n", |
| 72 | + " </tr>\n", |
| 73 | + " </thead>\n", |
| 74 | + " <tbody>\n", |
| 75 | + " <tr>\n", |
| 76 | + " <th>0</th>\n", |
| 77 | + " <td>first think another Disney movie, might good, ...</td>\n", |
| 78 | + " <td>1</td>\n", |
| 79 | + " </tr>\n", |
| 80 | + " <tr>\n", |
| 81 | + " <th>1</th>\n", |
| 82 | + " <td>Put aside Dr. House repeat missed, Desperate H...</td>\n", |
| 83 | + " <td>0</td>\n", |
| 84 | + " </tr>\n", |
| 85 | + " <tr>\n", |
| 86 | + " <th>2</th>\n", |
| 87 | + " <td>big fan Stephen King's work, film made even gr...</td>\n", |
| 88 | + " <td>1</td>\n", |
| 89 | + " </tr>\n", |
| 90 | + " <tr>\n", |
| 91 | + " <th>3</th>\n", |
| 92 | + " <td>watched horrid thing TV. Needless say one movi...</td>\n", |
| 93 | + " <td>0</td>\n", |
| 94 | + " </tr>\n", |
| 95 | + " <tr>\n", |
| 96 | + " <th>4</th>\n", |
| 97 | + " <td>truly enjoyed film. acting terrific plot. Jeff...</td>\n", |
| 98 | + " <td>1</td>\n", |
| 99 | + " </tr>\n", |
| 100 | + " </tbody>\n", |
| 101 | + "</table>\n", |
| 102 | + "</div>" |
| 103 | + ], |
| 104 | + "text/plain": [ |
| 105 | + " SentimentText Sentiment\n", |
| 106 | + "0 first think another Disney movie, might good, ... 1\n", |
| 107 | + "1 Put aside Dr. House repeat missed, Desperate H... 0\n", |
| 108 | + "2 big fan Stephen King's work, film made even gr... 1\n", |
| 109 | + "3 watched horrid thing TV. Needless say one movi... 0\n", |
| 110 | + "4 truly enjoyed film. acting terrific plot. Jeff... 1" |
| 111 | + ] |
| 112 | + }, |
| 113 | + "execution_count": 20, |
| 114 | + "metadata": {}, |
| 115 | + "output_type": "execute_result" |
| 116 | + } |
| 117 | + ], |
| 118 | + "source": [ |
| 119 | + "data.head()" |
| 120 | + ] |
| 121 | + }, |
| 122 | + { |
| 123 | + "cell_type": "code", |
| 124 | + "execution_count": null, |
| 125 | + "metadata": {}, |
| 126 | + "outputs": [], |
| 127 | + "source": [] |
| 128 | + } |
| 129 | + ], |
| 130 | + "metadata": { |
| 131 | + "kernelspec": { |
| 132 | + "display_name": "Python 3", |
| 133 | + "language": "python", |
| 134 | + "name": "python3" |
| 135 | + }, |
| 136 | + "language_info": { |
| 137 | + "codemirror_mode": { |
| 138 | + "name": "ipython", |
| 139 | + "version": 3 |
| 140 | + }, |
| 141 | + "file_extension": ".py", |
| 142 | + "mimetype": "text/x-python", |
| 143 | + "name": "python", |
| 144 | + "nbconvert_exporter": "python", |
| 145 | + "pygments_lexer": "ipython3", |
| 146 | + "version": "3.7.1" |
| 147 | + } |
| 148 | + }, |
| 149 | + "nbformat": 4, |
| 150 | + "nbformat_minor": 2 |
| 151 | +} |
0 commit comments