Skip to content

Commit c986ebe

Browse files
committed
Coursework
1 parent 000e15f commit c986ebe

9 files changed

+127
-23
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"github.gitCommand": "C:\\Users\\Name\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
3-
"python.pythonPath": "C:\\Users\\Name\\AppData\\Local\\Programs\\Python\\Python39\\python.exe"
3+
"python.pythonPath": "C:\\Users\\Name\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
4+
"python.languageServer": "Pylance"
45
}

6. Python 101 - Files - Skeleton before filming.ipynb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
},
6060
{
6161
"cell_type": "code",
62-
"execution_count": 96,
62+
"execution_count": 3,
6363
"metadata": {
6464
"colab": {
6565
"base_uri": "https://localhost:8080/",
@@ -81,18 +81,16 @@
8181
},
8282
"outputs": [
8383
{
84-
"name": "stdout",
8584
"output_type": "stream",
85+
"name": "stdout",
8686
"text": [
87-
"I am learning python now!\n",
88-
"It is super fun to learn Python programming \n",
89-
"I am learning how to handle files in python!THis is a new line that I added to the file!THis is a new line that I added to the file!THis is a new line that I added to the file!THis is a new line that I added to the file!THis is a new line that I added to the file!THis is a new line that I added to the file!\n"
87+
"First Name,Last Name,Email,Postal Code,Net Worth\nJoseph,Patton,[email protected],M6U 5U7,\"$2,629.13 \"\nNoah,Moran,[email protected],K2D 4M9,\"$8,626.96 \"\nNina,Keller,[email protected],S1T 4E6,\"$9,072.02 \"\n\n"
9088
]
9189
}
9290
],
9391
"source": [
9492
"# Open and read text file\n",
95-
"f=open('D:\\Python+for+Financial+Analysis+-+Course+Package\\Part 1. Python Programming Fundamentals\\sample_text_file.txt','r')\n",
93+
"f=open('G:\\Python+for+Financial+Analysis+-+Course+Package\\Part 1. Python Programming Fundamentals\\sample_text_file.txt','r')\n",
9694
"print(f.read())"
9795
]
9896
},
@@ -886,9 +884,9 @@
886884
"name": "python",
887885
"nbconvert_exporter": "python",
888886
"pygments_lexer": "ipython3",
889-
"version": "3.7.8"
887+
"version": "3.9.0-final"
890888
}
891889
},
892890
"nbformat": 4,
893891
"nbformat_minor": 4
894-
}
892+
}

7. Python 101 - Python Libraries for Data Analysis - Numpy Skeleton.ipynb

Lines changed: 82 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,30 +1440,76 @@
14401440
},
14411441
{
14421442
"cell_type": "code",
1443-
"execution_count": null,
1443+
"execution_count": 54,
14441444
"metadata": {
14451445
"id": "UujCvuhMCt4K"
14461446
},
1447-
"outputs": [],
1448-
"source": []
1447+
"outputs": [
1448+
{
1449+
"output_type": "execute_result",
1450+
"data": {
1451+
"text/plain": [
1452+
"array([[6, 4, 3, 9, 5],\n",
1453+
" [4, 1, 5, 3, 4],\n",
1454+
" [8, 8, 4, 3, 9],\n",
1455+
" [6, 7, 4, 5, 3],\n",
1456+
" [1, 4, 9, 2, 9]])"
1457+
]
1458+
},
1459+
"metadata": {},
1460+
"execution_count": 54
1461+
}
1462+
],
1463+
"source": [
1464+
"y=np.random.randint(1,10,(5,5))\n",
1465+
"y"
1466+
]
14491467
},
14501468
{
14511469
"cell_type": "code",
1452-
"execution_count": null,
1470+
"execution_count": 57,
14531471
"metadata": {
14541472
"id": "JBgJ8ugyCvht"
14551473
},
1456-
"outputs": [],
1457-
"source": []
1474+
"outputs": [
1475+
{
1476+
"output_type": "execute_result",
1477+
"data": {
1478+
"text/plain": [
1479+
"array([6, 4, 9, 5, 4, 5, 4, 8, 8, 4, 9, 6, 7, 4, 5, 4, 9, 9])"
1480+
]
1481+
},
1482+
"metadata": {},
1483+
"execution_count": 57
1484+
}
1485+
],
1486+
"source": [
1487+
"n_y=y[y>3]\n",
1488+
"n_y"
1489+
]
14581490
},
14591491
{
14601492
"cell_type": "code",
1461-
"execution_count": null,
1493+
"execution_count": 60,
14621494
"metadata": {
14631495
"id": "TIQ-A7IBCvgl"
14641496
},
1465-
"outputs": [],
1466-
"source": []
1497+
"outputs": [
1498+
{
1499+
"output_type": "execute_result",
1500+
"data": {
1501+
"text/plain": [
1502+
"array([3, 9, 5, 1, 5, 3, 3, 9, 7, 5, 3, 1, 9, 9])"
1503+
]
1504+
},
1505+
"metadata": {},
1506+
"execution_count": 60
1507+
}
1508+
],
1509+
"source": [
1510+
"n_y=y[y%2==1]\n",
1511+
"n_y"
1512+
]
14671513
},
14681514
{
14691515
"cell_type": "markdown",
@@ -1486,12 +1532,36 @@
14861532
},
14871533
{
14881534
"cell_type": "code",
1489-
"execution_count": null,
1535+
"execution_count": 71,
14901536
"metadata": {
14911537
"id": "AbN-vySf9gen"
14921538
},
1493-
"outputs": [],
1494-
"source": []
1539+
"outputs": [
1540+
{
1541+
"output_type": "execute_result",
1542+
"data": {
1543+
"text/plain": [
1544+
"array([[ 2, 30, 20, 0, 0],\n",
1545+
" [25, 4, 40, 0, 0],\n",
1546+
" [ 0, 4, 0, 90, 10],\n",
1547+
" [25, 25, 34, 22, 12],\n",
1548+
" [25, 24, 22, 32, 25]])"
1549+
]
1550+
},
1551+
"metadata": {},
1552+
"execution_count": 71
1553+
}
1554+
],
1555+
"source": [
1556+
"x=np.array([[2, 30, 20, -2, -4],\n",
1557+
" [3, 4, 40, -3, -2],\n",
1558+
" [-3, 4, -6, 90, 10],\n",
1559+
" [25, 45 ,34 ,22 ,12],\n",
1560+
" [13, 24, 22, 32, 37]])\n",
1561+
"x[x<0]=0\n",
1562+
"x[x%2==1]=25\n",
1563+
"x"
1564+
]
14951565
},
14961566
{
14971567
"cell_type": "markdown",

8. Python 101 - Python Libraries for Data Analysis - Pandas Skeleton.ipynb

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

9. Python 101 - Data Visualization with matplotlib - Skeleton b4 filming.ipynb

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Untitled-1.py

Whitespace-only changes.

import numpy as np.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import numpy as np
2+
import os
3+
import time
4+
5+
os.environ["KERAS_BACKEND"] = "plaidml.keras.backend"
6+
7+
import keras
8+
import keras.applications as kapp
9+
from keras.datasets import cifar10
10+
11+
(x_train, y_train_cats), (x_test, y_test_cats) = cifar10.load_data()
12+
batch_size = 8
13+
x_train = x_train[:batch_size]
14+
x_train = np.repeat(np.repeat(x_train, 7, axis=1), 7, axis=2)
15+
model = kapp.VGG19()
16+
model.compile(optimizer='sgd', loss='categorical_crossentropy',
17+
metrics=['accuracy'])
18+
19+
print("Running initial batch (compiling tile program)")
20+
y = model.predict(x=x_train, batch_size=batch_size)
21+
22+
# Now start the clock and run 10 batches
23+
print("Timing inference...")
24+
start = time.time()
25+
for i in range(1):
26+
y = model.predict(x=x_train, batch_size=batch_size)
27+
print("Ran in {} seconds".format(time.time() - start))

sample output index.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
,First Name,Last Name,Email,Postal Code,Net Worth
2+
0,Joseph,Patton,[email protected],M6U 5U7,"$2,629.13 "
3+
1,Noah,Moran,[email protected],K2D 4M9,"$8,626.96 "
4+
2,Nina,Keller,[email protected],S1T 4E6,"$9,072.02 "

sample output.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
First Name,Last Name,Email,Postal Code,Net Worth
2+
Joseph,Patton,[email protected],M6U 5U7,"$2,629.13 "
3+
Noah,Moran,[email protected],K2D 4M9,"$8,626.96 "
4+
Nina,Keller,[email protected],S1T 4E6,"$9,072.02 "

0 commit comments

Comments
 (0)