Skip to content

Commit c21ae56

Browse files
committed
Repository created
1 parent f70f9a8 commit c21ae56

File tree

27 files changed

+5023
-0
lines changed

27 files changed

+5023
-0
lines changed

Activity01.ipynb

Lines changed: 851 additions & 0 deletions
Large diffs are not rendered by default.

Exercise01/Exercise01.ipynb

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"1. Import the numpy package"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 2,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"import numpy as np"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {},
22+
"source": [
23+
"2. create a list of 3 elements."
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": 3,
29+
"metadata": {},
30+
"outputs": [
31+
{
32+
"data": {
33+
"text/plain": [
34+
"[1, 2, 3]"
35+
]
36+
},
37+
"execution_count": 3,
38+
"metadata": {},
39+
"output_type": "execute_result"
40+
}
41+
],
42+
"source": [
43+
"list_1 = [1,2,3] \n",
44+
"list_1"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"metadata": {},
50+
"source": [
51+
"3. convert the list to a numpy array"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": 4,
57+
"metadata": {},
58+
"outputs": [
59+
{
60+
"data": {
61+
"text/plain": [
62+
"array([1, 2, 3])"
63+
]
64+
},
65+
"execution_count": 4,
66+
"metadata": {},
67+
"output_type": "execute_result"
68+
}
69+
],
70+
"source": [
71+
"array_1 = np.array(list_1)\n",
72+
"array_1"
73+
]
74+
},
75+
{
76+
"cell_type": "markdown",
77+
"metadata": {},
78+
"source": [
79+
"4. Create an array of floating Numbers"
80+
]
81+
},
82+
{
83+
"cell_type": "code",
84+
"execution_count": 5,
85+
"metadata": {},
86+
"outputs": [
87+
{
88+
"data": {
89+
"text/plain": [
90+
"array([1.2, 3.4, 5.6])"
91+
]
92+
},
93+
"execution_count": 5,
94+
"metadata": {},
95+
"output_type": "execute_result"
96+
}
97+
],
98+
"source": [
99+
"a = np.array([1.2, 3.4, 5.6]) \n",
100+
"a "
101+
]
102+
},
103+
{
104+
"cell_type": "markdown",
105+
"metadata": {},
106+
"source": [
107+
"5. Check the type of both objects"
108+
]
109+
},
110+
{
111+
"cell_type": "code",
112+
"execution_count": 6,
113+
"metadata": {},
114+
"outputs": [
115+
{
116+
"data": {
117+
"text/plain": [
118+
"numpy.ndarray"
119+
]
120+
},
121+
"execution_count": 6,
122+
"metadata": {},
123+
"output_type": "execute_result"
124+
}
125+
],
126+
"source": [
127+
"type(a)"
128+
]
129+
},
130+
{
131+
"cell_type": "code",
132+
"execution_count": 7,
133+
"metadata": {},
134+
"outputs": [
135+
{
136+
"data": {
137+
"text/plain": [
138+
"numpy.ndarray"
139+
]
140+
},
141+
"execution_count": 7,
142+
"metadata": {},
143+
"output_type": "execute_result"
144+
}
145+
],
146+
"source": [
147+
"type(array_1)"
148+
]
149+
},
150+
{
151+
"cell_type": "code",
152+
"execution_count": null,
153+
"metadata": {},
154+
"outputs": [],
155+
"source": [
156+
"type(list_1)"
157+
]
158+
},
159+
{
160+
"cell_type": "markdown",
161+
"metadata": {},
162+
"source": [
163+
"6. load data from a csv into a numpy array"
164+
]
165+
},
166+
{
167+
"cell_type": "code",
168+
"execution_count": 9,
169+
"metadata": {},
170+
"outputs": [
171+
{
172+
"data": {
173+
"text/plain": [
174+
"array([('MMM', 100), ('AOS', 101), ('ABT', 102), ('ABBV', 103),\n",
175+
" ('ACN', 104), ('ATVI', 105), ('AYI', 106), ('ADBE', 107),\n",
176+
" ('AAP', 108), ('AMD', 109), ('AES', 110), ('AET', 111),\n",
177+
" ('AMG', 112), ('AFL', 113), ('A', 114), ('APD', 115),\n",
178+
" ('AKAM', 116), ('ALK', 117), ('ALB', 118), ('ARE', 119),\n",
179+
" ('ALXN', 120), ('ALGN', 121), ('ALLE', 122), ('AGN', 123),\n",
180+
" ('ADS', 124), ('LNT', 125), ('ALL', 126), ('GOOGL', 127),\n",
181+
" ('GOOG', 128), ('MO', 129), ('AMZN', 130), ('AEE', 131),\n",
182+
" ('AAL', 132), ('AEP', 133), ('AXP', 134), ('AIG', 135),\n",
183+
" ('AMT', 136), ('AWK', 137), ('AMP', 138), ('ABC', 139),\n",
184+
" ('AME', 140), ('AMGN', 141), ('APH', 142), ('APC', 143),\n",
185+
" ('ADI', 144), ('ANDV', 145), ('ANSS', 146), ('ANTM', 147),\n",
186+
" ('AON', 148)], dtype=[('Symbol', '<U5'), ('Price', '<i8')])"
187+
]
188+
},
189+
"execution_count": 9,
190+
"metadata": {},
191+
"output_type": "execute_result"
192+
}
193+
],
194+
"source": [
195+
"data = np.genfromtxt('stock.csv', delimiter=',', names=True,dtype=None, encoding='ascii')\n",
196+
"data"
197+
]
198+
},
199+
{
200+
"cell_type": "code",
201+
"execution_count": null,
202+
"metadata": {},
203+
"outputs": [],
204+
"source": [
205+
"type(data)"
206+
]
207+
}
208+
],
209+
"metadata": {
210+
"kernelspec": {
211+
"display_name": "Python 3",
212+
"language": "python",
213+
"name": "python3"
214+
},
215+
"language_info": {
216+
"codemirror_mode": {
217+
"name": "ipython",
218+
"version": 3
219+
},
220+
"file_extension": ".py",
221+
"mimetype": "text/x-python",
222+
"name": "python",
223+
"nbconvert_exporter": "python",
224+
"pygments_lexer": "ipython3",
225+
"version": "3.7.3"
226+
}
227+
},
228+
"nbformat": 4,
229+
"nbformat_minor": 4
230+
}

Exercise02/Exercise02.ipynb

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"1. create an array and a list from exercise 26"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 1,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"import numpy as np\n",
17+
"list_1 = [1,2,3] "
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": 6,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"array_1 = np.array(list_1) "
27+
]
28+
},
29+
{
30+
"cell_type": "markdown",
31+
"metadata": {},
32+
"source": [
33+
"2. concat list_1 with itself."
34+
]
35+
},
36+
{
37+
"cell_type": "code",
38+
"execution_count": 2,
39+
"metadata": {},
40+
"outputs": [],
41+
"source": [
42+
"list_2 = list_1 + list_1"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": 3,
48+
"metadata": {},
49+
"outputs": [
50+
{
51+
"data": {
52+
"text/plain": [
53+
"[1, 2, 3, 1, 2, 3]"
54+
]
55+
},
56+
"execution_count": 3,
57+
"metadata": {},
58+
"output_type": "execute_result"
59+
}
60+
],
61+
"source": [
62+
"list_2"
63+
]
64+
},
65+
{
66+
"cell_type": "markdown",
67+
"metadata": {},
68+
"source": [
69+
"3. concat array_1 with itself"
70+
]
71+
},
72+
{
73+
"cell_type": "code",
74+
"execution_count": 9,
75+
"metadata": {},
76+
"outputs": [
77+
{
78+
"data": {
79+
"text/plain": [
80+
"array([2, 4, 6])"
81+
]
82+
},
83+
"execution_count": 9,
84+
"metadata": {},
85+
"output_type": "execute_result"
86+
}
87+
],
88+
"source": [
89+
"array_2 = array_1 + array_1 \n",
90+
"array_2"
91+
]
92+
},
93+
{
94+
"cell_type": "markdown",
95+
"metadata": {},
96+
"source": [
97+
"4. Load a csv file and concatinate it with itself."
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": 23,
103+
"metadata": {},
104+
"outputs": [
105+
{
106+
"data": {
107+
"text/plain": [
108+
"array([202., 204., 206., 208., 210., 212., 214., 216., 218., 220., 222.,\n",
109+
" 224., 226., 228., 230., 232., 234., 236., 238., 240., 242., 244.,\n",
110+
" 246., 248., 250., 252., 254., 256., 258., 260., 262., 264., 266.,\n",
111+
" 268., 270., 272., 274., 276., 278., 280., 282., 284., 286., 288.,\n",
112+
" 290., 292., 294., 296.])"
113+
]
114+
},
115+
"execution_count": 23,
116+
"metadata": {},
117+
"output_type": "execute_result"
118+
}
119+
],
120+
"source": [
121+
"data = np.genfromtxt('numbers.csv', delimiter=',', names=True)\n",
122+
"data = data.astype('float64')\n",
123+
"data + data"
124+
]
125+
}
126+
],
127+
"metadata": {
128+
"kernelspec": {
129+
"display_name": "Python 3",
130+
"language": "python",
131+
"name": "python3"
132+
},
133+
"language_info": {
134+
"codemirror_mode": {
135+
"name": "ipython",
136+
"version": 3
137+
},
138+
"file_extension": ".py",
139+
"mimetype": "text/x-python",
140+
"name": "python",
141+
"nbconvert_exporter": "python",
142+
"pygments_lexer": "ipython3",
143+
"version": "3.7.3"
144+
}
145+
},
146+
"nbformat": 4,
147+
"nbformat_minor": 4
148+
}

0 commit comments

Comments
 (0)