|
25 | 25 | "cell_type": "markdown", |
26 | 26 | "metadata": {}, |
27 | 27 | "source": [ |
28 | | - "### Installing Pandas" |
| 28 | + "### Installing Dependencies" |
29 | 29 | ] |
30 | 30 | }, |
31 | 31 | { |
32 | 32 | "cell_type": "markdown", |
33 | 33 | "metadata": {}, |
34 | 34 | "source": [ |
35 | 35 | "```console\n", |
36 | | - "$ python -m pip install pandas\n", |
| 36 | + "$ python3 -m pip install requests pandas matplotlib\n", |
37 | 37 | "```" |
38 | 38 | ] |
39 | 39 | }, |
|
42 | 42 | "metadata": {}, |
43 | 43 | "source": [ |
44 | 44 | "```console\n", |
45 | | - "$ conda install pandas\n", |
| 45 | + "$ conda install requests pandas matplotlib\n", |
46 | 46 | "```" |
47 | 47 | ] |
48 | 48 | }, |
|
197 | 197 | "outputs": [], |
198 | 198 | "source": [ |
199 | 199 | "import numpy as np\n", |
200 | | - "nba.describe(include=np.object)" |
| 200 | + "nba.describe(include=object)" |
201 | 201 | ] |
202 | 202 | }, |
203 | 203 | { |
|
230 | 230 | "source": [ |
231 | 231 | "nba[\"fran_id\"].value_counts()\n", |
232 | 232 | "# Expected:\n", |
233 | | - "# Name: team_id, Length: 104, dtype: int64\n", |
234 | 233 | "# Lakers 6024\n", |
235 | 234 | "# Celtics 5997\n", |
236 | 235 | "# Knicks 5769\n", |
237 | 236 | "\n", |
238 | | - "# Huskies 60\n", |
| 237 | + "# Falcons 60\n", |
239 | 238 | "# Name: fran_id, dtype: int64" |
240 | 239 | ] |
241 | 240 | }, |
|
484 | 483 | "city_data.values\n", |
485 | 484 | "# Expected:\n", |
486 | 485 | "# array([[4.2e+03, 5.0e+00],\n", |
487 | | - "# [6.5e+03, 8.0e+00],\n", |
488 | | - "# [8.0e+03, nan]])" |
| 486 | + "# [6.5e+03, 8.0e+00],\n", |
| 487 | + "# [8.0e+03, nan]])" |
489 | 488 | ] |
490 | 489 | }, |
491 | 490 | { |
|
922 | 921 | "current_decade = nba[nba[\"year_id\"] > 2010]\n", |
923 | 922 | "current_decade.shape\n", |
924 | 923 | "# Expected:\n", |
925 | | - "# (12658, 23)" |
| 924 | + "# (12658, 24)" |
926 | 925 | ] |
927 | 926 | }, |
928 | 927 | { |
|
934 | 933 | "games_with_notes = nba[nba[\"notes\"].notnull()]\n", |
935 | 934 | "games_with_notes.shape\n", |
936 | 935 | "# Expected:\n", |
937 | | - "# (5424, 23)" |
| 936 | + "# (5424, 24)" |
938 | 937 | ] |
939 | 938 | }, |
940 | 939 | { |
|
946 | 945 | "ers = nba[nba[\"fran_id\"].str.endswith(\"ers\")]\n", |
947 | 946 | "ers.shape\n", |
948 | 947 | "# Expected:\n", |
949 | | - "# (27797, 23)" |
| 948 | + "# (27797, 24)" |
950 | 949 | ] |
951 | 950 | }, |
952 | 951 | { |
|
1111 | 1110 | "df = nba.copy()\n", |
1112 | 1111 | "df.shape\n", |
1113 | 1112 | "# Expected:\n", |
1114 | | - "# (126314, 23)" |
| 1113 | + "# (126314, 24)" |
1115 | 1114 | ] |
1116 | 1115 | }, |
1117 | 1116 | { |
|
1130 | 1129 | "df[\"difference\"] = df.pts - df.opp_pts\n", |
1131 | 1130 | "df.shape\n", |
1132 | 1131 | "# Expected:\n", |
1133 | | - "# (126314, 24)" |
| 1132 | + "# (126314, 25)" |
1134 | 1133 | ] |
1135 | 1134 | }, |
1136 | 1135 | { |
|
1164 | 1163 | "# Expected:\n", |
1165 | 1164 | "# <class 'pandas.core.frame.DataFrame'>\n", |
1166 | 1165 | "# RangeIndex: 126314 entries, 0 to 126313\n", |
1167 | | - "# Data columns (total 24 columns):\n", |
| 1166 | + "# Data columns (total 25 columns):\n", |
1168 | 1167 | "# gameorder 126314 non-null int64\n", |
1169 | 1168 | "\n", |
1170 | 1169 | "# location 126314 non-null object\n", |
1171 | 1170 | "# result 126314 non-null object\n", |
1172 | 1171 | "# forecast 126314 non-null float64\n", |
1173 | 1172 | "# notes 5424 non-null object\n", |
| 1173 | + "# date_played 126314 non-null datetime64[ns]\n", |
1174 | 1174 | "# difference 126314 non-null int64\n", |
1175 | | - "# dtypes: float64(6), int64(8), object(10)\n", |
1176 | | - "# memory usage: 23.1+ MB" |
| 1175 | + "# dtypes: datetime64[ns](1), float64(6), int64(8), object(10)\n", |
| 1176 | + "# memory usage: 24.1+ MB" |
1177 | 1177 | ] |
1178 | 1178 | }, |
1179 | 1179 | { |
|
1191 | 1191 | "source": [ |
1192 | 1192 | "df.shape\n", |
1193 | 1193 | "# Expected:\n", |
1194 | | - "# (126314, 24)" |
| 1194 | + "# (126314, 25)" |
1195 | 1195 | ] |
1196 | 1196 | }, |
1197 | 1197 | { |
|
1204 | 1204 | "df.drop(elo_columns, inplace=True, axis=1)\n", |
1205 | 1205 | "df.shape\n", |
1206 | 1206 | "# Expected:\n", |
1207 | | - "# (126314, 20)" |
| 1207 | + "# (126314, 21)" |
1208 | 1208 | ] |
1209 | 1209 | }, |
1210 | 1210 | { |
|
1310 | 1310 | "rows_without_missing_data = nba.dropna()\n", |
1311 | 1311 | "rows_without_missing_data.shape\n", |
1312 | 1312 | "# Expected:\n", |
1313 | | - "# (5424, 23)" |
| 1313 | + "# (5424, 24)" |
1314 | 1314 | ] |
1315 | 1315 | }, |
1316 | 1316 | { |
|
1322 | 1322 | "data_without_missing_columns = nba.dropna(axis=1)\n", |
1323 | 1323 | "data_without_missing_columns.shape\n", |
1324 | 1324 | "# Expected:\n", |
1325 | | - "# (126314, 22)" |
| 1325 | + "# (126314, 23)" |
1326 | 1326 | ] |
1327 | 1327 | }, |
1328 | 1328 | { |
|
1565 | 1565 | "name": "python", |
1566 | 1566 | "nbconvert_exporter": "python", |
1567 | 1567 | "pygments_lexer": "ipython3", |
1568 | | - "version": "3.9.1" |
| 1568 | + "version": "3.9.2" |
1569 | 1569 | } |
1570 | 1570 | }, |
1571 | 1571 | "nbformat": 4, |
1572 | | - "nbformat_minor": 2 |
| 1572 | + "nbformat_minor": 4 |
1573 | 1573 | } |
0 commit comments