Skip to content

Commit 15de955

Browse files
author
Bruno Goncalves
committed
clean up notebooks
1 parent 1de312a commit 15de955

10 files changed

+2021
-794
lines changed

1. Pitfalls.ipynb

+273-16
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@
5858
"\n",
5959
"Compiler : Clang 10.0.0 \n",
6060
"OS : Darwin\n",
61-
"Release : 20.3.0\n",
61+
"Release : 20.6.0\n",
6262
"Machine : x86_64\n",
6363
"Processor : i386\n",
6464
"CPU cores : 16\n",
6565
"Architecture: 64bit\n",
6666
"\n",
67-
"Git hash: cf1f9e0456cec9d5d960512c3269cc904d79928a\n",
67+
"Git hash: 1de312ab8ec83b204e8a22ebe02393243330f40f\n",
6868
"\n",
69+
"watermark : 2.1.0\n",
6970
"matplotlib : 3.3.2\n",
70-
"numpy : 1.19.2\n",
7171
"numpy_financial: 1.0.0\n",
72-
"watermark : 2.1.0\n",
7372
"json : 2.0.9\n",
73+
"numpy : 1.19.2\n",
7474
"pandas : 1.1.3\n",
7575
"\n"
7676
]
@@ -958,6 +958,33 @@
958958
"dates = pd.date_range('08/01/2020', periods=months, freq='M')+pd.Timedelta('1D')"
959959
]
960960
},
961+
{
962+
"cell_type": "code",
963+
"execution_count": 13,
964+
"metadata": {},
965+
"outputs": [
966+
{
967+
"data": {
968+
"text/plain": [
969+
"DatetimeIndex(['2020-09-01', '2020-10-01', '2020-11-01', '2020-12-01',\n",
970+
" '2021-01-01', '2021-02-01', '2021-03-01', '2021-04-01',\n",
971+
" '2021-05-01', '2021-06-01',\n",
972+
" ...\n",
973+
" '2049-11-01', '2049-12-01', '2050-01-01', '2050-02-01',\n",
974+
" '2050-03-01', '2050-04-01', '2050-05-01', '2050-06-01',\n",
975+
" '2050-07-01', '2050-08-01'],\n",
976+
" dtype='datetime64[ns]', length=360, freq=None)"
977+
]
978+
},
979+
"execution_count": 13,
980+
"metadata": {},
981+
"output_type": "execute_result"
982+
}
983+
],
984+
"source": [
985+
"dates"
986+
]
987+
},
961988
{
962989
"cell_type": "markdown",
963990
"metadata": {},
@@ -967,7 +994,7 @@
967994
},
968995
{
969996
"cell_type": "code",
970-
"execution_count": 13,
997+
"execution_count": 14,
971998
"metadata": {},
972999
"outputs": [],
9731000
"source": [
@@ -1007,7 +1034,7 @@
10071034
},
10081035
{
10091036
"cell_type": "code",
1010-
"execution_count": 14,
1037+
"execution_count": 15,
10111038
"metadata": {},
10121039
"outputs": [],
10131040
"source": [
@@ -1018,7 +1045,7 @@
10181045
},
10191046
{
10201047
"cell_type": "code",
1021-
"execution_count": 15,
1048+
"execution_count": 16,
10221049
"metadata": {},
10231050
"outputs": [
10241051
{
@@ -1234,7 +1261,7 @@
12341261
"[344 rows x 9 columns]"
12351262
]
12361263
},
1237-
"execution_count": 15,
1264+
"execution_count": 16,
12381265
"metadata": {},
12391266
"output_type": "execute_result"
12401267
}
@@ -1252,13 +1279,243 @@
12521279
},
12531280
{
12541281
"cell_type": "code",
1255-
"execution_count": 16,
1282+
"execution_count": 17,
12561283
"metadata": {},
12571284
"outputs": [],
12581285
"source": [
12591286
"movies = pd.read_excel('data/movies.xlsx')"
12601287
]
12611288
},
1289+
{
1290+
"cell_type": "code",
1291+
"execution_count": 18,
1292+
"metadata": {},
1293+
"outputs": [
1294+
{
1295+
"data": {
1296+
"text/html": [
1297+
"<div>\n",
1298+
"<style scoped>\n",
1299+
" .dataframe tbody tr th:only-of-type {\n",
1300+
" vertical-align: middle;\n",
1301+
" }\n",
1302+
"\n",
1303+
" .dataframe tbody tr th {\n",
1304+
" vertical-align: top;\n",
1305+
" }\n",
1306+
"\n",
1307+
" .dataframe thead th {\n",
1308+
" text-align: right;\n",
1309+
" }\n",
1310+
"</style>\n",
1311+
"<table border=\"1\" class=\"dataframe\">\n",
1312+
" <thead>\n",
1313+
" <tr style=\"text-align: right;\">\n",
1314+
" <th></th>\n",
1315+
" <th>Title</th>\n",
1316+
" <th>Year</th>\n",
1317+
" <th>Genres</th>\n",
1318+
" <th>Language</th>\n",
1319+
" <th>Country</th>\n",
1320+
" <th>Content Rating</th>\n",
1321+
" <th>Duration</th>\n",
1322+
" <th>Aspect Ratio</th>\n",
1323+
" <th>Budget</th>\n",
1324+
" <th>Gross Earnings</th>\n",
1325+
" <th>...</th>\n",
1326+
" <th>Facebook Likes - Actor 1</th>\n",
1327+
" <th>Facebook Likes - Actor 2</th>\n",
1328+
" <th>Facebook Likes - Actor 3</th>\n",
1329+
" <th>Facebook Likes - cast Total</th>\n",
1330+
" <th>Facebook likes - Movie</th>\n",
1331+
" <th>Facenumber in posters</th>\n",
1332+
" <th>User Votes</th>\n",
1333+
" <th>Reviews by Users</th>\n",
1334+
" <th>Reviews by Crtiics</th>\n",
1335+
" <th>IMDB Score</th>\n",
1336+
" </tr>\n",
1337+
" </thead>\n",
1338+
" <tbody>\n",
1339+
" <tr>\n",
1340+
" <th>0</th>\n",
1341+
" <td>Intolerance: Love's Struggle Throughout the Ages</td>\n",
1342+
" <td>1916</td>\n",
1343+
" <td>Drama|History|War</td>\n",
1344+
" <td>NaN</td>\n",
1345+
" <td>USA</td>\n",
1346+
" <td>Not Rated</td>\n",
1347+
" <td>123</td>\n",
1348+
" <td>1.33</td>\n",
1349+
" <td>385907.0</td>\n",
1350+
" <td>NaN</td>\n",
1351+
" <td>...</td>\n",
1352+
" <td>436</td>\n",
1353+
" <td>22</td>\n",
1354+
" <td>9.0</td>\n",
1355+
" <td>481</td>\n",
1356+
" <td>691</td>\n",
1357+
" <td>1</td>\n",
1358+
" <td>10718</td>\n",
1359+
" <td>88</td>\n",
1360+
" <td>69.0</td>\n",
1361+
" <td>8.0</td>\n",
1362+
" </tr>\n",
1363+
" <tr>\n",
1364+
" <th>1</th>\n",
1365+
" <td>Over the Hill to the Poorhouse</td>\n",
1366+
" <td>1920</td>\n",
1367+
" <td>Crime|Drama</td>\n",
1368+
" <td>NaN</td>\n",
1369+
" <td>USA</td>\n",
1370+
" <td>NaN</td>\n",
1371+
" <td>110</td>\n",
1372+
" <td>1.33</td>\n",
1373+
" <td>100000.0</td>\n",
1374+
" <td>3000000.0</td>\n",
1375+
" <td>...</td>\n",
1376+
" <td>2</td>\n",
1377+
" <td>2</td>\n",
1378+
" <td>0.0</td>\n",
1379+
" <td>4</td>\n",
1380+
" <td>0</td>\n",
1381+
" <td>1</td>\n",
1382+
" <td>5</td>\n",
1383+
" <td>1</td>\n",
1384+
" <td>1.0</td>\n",
1385+
" <td>4.8</td>\n",
1386+
" </tr>\n",
1387+
" <tr>\n",
1388+
" <th>2</th>\n",
1389+
" <td>The Big Parade</td>\n",
1390+
" <td>1925</td>\n",
1391+
" <td>Drama|Romance|War</td>\n",
1392+
" <td>NaN</td>\n",
1393+
" <td>USA</td>\n",
1394+
" <td>Not Rated</td>\n",
1395+
" <td>151</td>\n",
1396+
" <td>1.33</td>\n",
1397+
" <td>245000.0</td>\n",
1398+
" <td>NaN</td>\n",
1399+
" <td>...</td>\n",
1400+
" <td>81</td>\n",
1401+
" <td>12</td>\n",
1402+
" <td>6.0</td>\n",
1403+
" <td>108</td>\n",
1404+
" <td>226</td>\n",
1405+
" <td>0</td>\n",
1406+
" <td>4849</td>\n",
1407+
" <td>45</td>\n",
1408+
" <td>48.0</td>\n",
1409+
" <td>8.3</td>\n",
1410+
" </tr>\n",
1411+
" <tr>\n",
1412+
" <th>3</th>\n",
1413+
" <td>Metropolis</td>\n",
1414+
" <td>1927</td>\n",
1415+
" <td>Drama|Sci-Fi</td>\n",
1416+
" <td>German</td>\n",
1417+
" <td>Germany</td>\n",
1418+
" <td>Not Rated</td>\n",
1419+
" <td>145</td>\n",
1420+
" <td>1.33</td>\n",
1421+
" <td>6000000.0</td>\n",
1422+
" <td>26435.0</td>\n",
1423+
" <td>...</td>\n",
1424+
" <td>136</td>\n",
1425+
" <td>23</td>\n",
1426+
" <td>18.0</td>\n",
1427+
" <td>203</td>\n",
1428+
" <td>12000</td>\n",
1429+
" <td>1</td>\n",
1430+
" <td>111841</td>\n",
1431+
" <td>413</td>\n",
1432+
" <td>260.0</td>\n",
1433+
" <td>8.3</td>\n",
1434+
" </tr>\n",
1435+
" <tr>\n",
1436+
" <th>4</th>\n",
1437+
" <td>Pandora's Box</td>\n",
1438+
" <td>1929</td>\n",
1439+
" <td>Crime|Drama|Romance</td>\n",
1440+
" <td>German</td>\n",
1441+
" <td>Germany</td>\n",
1442+
" <td>Not Rated</td>\n",
1443+
" <td>110</td>\n",
1444+
" <td>1.33</td>\n",
1445+
" <td>NaN</td>\n",
1446+
" <td>9950.0</td>\n",
1447+
" <td>...</td>\n",
1448+
" <td>426</td>\n",
1449+
" <td>20</td>\n",
1450+
" <td>3.0</td>\n",
1451+
" <td>455</td>\n",
1452+
" <td>926</td>\n",
1453+
" <td>1</td>\n",
1454+
" <td>7431</td>\n",
1455+
" <td>84</td>\n",
1456+
" <td>71.0</td>\n",
1457+
" <td>8.0</td>\n",
1458+
" </tr>\n",
1459+
" </tbody>\n",
1460+
"</table>\n",
1461+
"<p>5 rows × 25 columns</p>\n",
1462+
"</div>"
1463+
],
1464+
"text/plain": [
1465+
" Title Year \\\n",
1466+
"0 Intolerance: Love's Struggle Throughout the Ages  1916 \n",
1467+
"1 Over the Hill to the Poorhouse  1920 \n",
1468+
"2 The Big Parade  1925 \n",
1469+
"3 Metropolis  1927 \n",
1470+
"4 Pandora's Box  1929 \n",
1471+
"\n",
1472+
" Genres Language Country Content Rating Duration \\\n",
1473+
"0 Drama|History|War NaN USA Not Rated 123 \n",
1474+
"1 Crime|Drama NaN USA NaN 110 \n",
1475+
"2 Drama|Romance|War NaN USA Not Rated 151 \n",
1476+
"3 Drama|Sci-Fi German Germany Not Rated 145 \n",
1477+
"4 Crime|Drama|Romance German Germany Not Rated 110 \n",
1478+
"\n",
1479+
" Aspect Ratio Budget Gross Earnings ... Facebook Likes - Actor 1 \\\n",
1480+
"0 1.33 385907.0 NaN ... 436 \n",
1481+
"1 1.33 100000.0 3000000.0 ... 2 \n",
1482+
"2 1.33 245000.0 NaN ... 81 \n",
1483+
"3 1.33 6000000.0 26435.0 ... 136 \n",
1484+
"4 1.33 NaN 9950.0 ... 426 \n",
1485+
"\n",
1486+
" Facebook Likes - Actor 2 Facebook Likes - Actor 3 \\\n",
1487+
"0 22 9.0 \n",
1488+
"1 2 0.0 \n",
1489+
"2 12 6.0 \n",
1490+
"3 23 18.0 \n",
1491+
"4 20 3.0 \n",
1492+
"\n",
1493+
" Facebook Likes - cast Total Facebook likes - Movie Facenumber in posters \\\n",
1494+
"0 481 691 1 \n",
1495+
"1 4 0 1 \n",
1496+
"2 108 226 0 \n",
1497+
"3 203 12000 1 \n",
1498+
"4 455 926 1 \n",
1499+
"\n",
1500+
" User Votes Reviews by Users Reviews by Crtiics IMDB Score \n",
1501+
"0 10718 88 69.0 8.0 \n",
1502+
"1 5 1 1.0 4.8 \n",
1503+
"2 4849 45 48.0 8.3 \n",
1504+
"3 111841 413 260.0 8.3 \n",
1505+
"4 7431 84 71.0 8.0 \n",
1506+
"\n",
1507+
"[5 rows x 25 columns]"
1508+
]
1509+
},
1510+
"execution_count": 18,
1511+
"metadata": {},
1512+
"output_type": "execute_result"
1513+
}
1514+
],
1515+
"source": [
1516+
"movies.head()"
1517+
]
1518+
},
12621519
{
12631520
"cell_type": "markdown",
12641521
"metadata": {},
@@ -1268,22 +1525,22 @@
12681525
},
12691526
{
12701527
"cell_type": "code",
1271-
"execution_count": 17,
1528+
"execution_count": 19,
12721529
"metadata": {},
12731530
"outputs": [
12741531
{
12751532
"data": {
12761533
"text/plain": [
1277-
"\"Intolerance: Love's Struggle Throughout the Ages\\xa0\""
1534+
"'It Happened One Night\\xa0'"
12781535
]
12791536
},
1280-
"execution_count": 17,
1537+
"execution_count": 19,
12811538
"metadata": {},
12821539
"output_type": "execute_result"
12831540
}
12841541
],
12851542
"source": [
1286-
"movies['Title'].iloc[0]"
1543+
"movies['Title'].iloc[10]"
12871544
]
12881545
},
12891546
{
@@ -1295,7 +1552,7 @@
12951552
},
12961553
{
12971554
"cell_type": "code",
1298-
"execution_count": 18,
1555+
"execution_count": 20,
12991556
"metadata": {},
13001557
"outputs": [],
13011558
"source": [
@@ -1304,7 +1561,7 @@
13041561
},
13051562
{
13061563
"cell_type": "code",
1307-
"execution_count": 19,
1564+
"execution_count": 21,
13081565
"metadata": {},
13091566
"outputs": [
13101567
{
@@ -1313,7 +1570,7 @@
13131570
"\"Intolerance: Love's Struggle Throughout the Ages\""
13141571
]
13151572
},
1316-
"execution_count": 19,
1573+
"execution_count": 21,
13171574
"metadata": {},
13181575
"output_type": "execute_result"
13191576
}

0 commit comments

Comments
 (0)