Skip to content

Commit 5cce19c

Browse files
author
craigsdennis
committed
Creates study_minutes array
1 parent 0a6ef19 commit 5cce19c

File tree

1 file changed

+170
-0
lines changed

1 file changed

+170
-0
lines changed

Introduction to NumPy.ipynb

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,183 @@
211211
"gpas.nbytes"
212212
]
213213
},
214+
{
215+
"cell_type": "markdown",
216+
"metadata": {},
217+
"source": [
218+
"## About data types\n"
219+
]
220+
},
221+
{
222+
"cell_type": "code",
223+
"execution_count": 16,
224+
"metadata": {},
225+
"outputs": [
226+
{
227+
"data": {
228+
"text/plain": [
229+
"array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
230+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
231+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
232+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
233+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=uint16)"
234+
]
235+
},
236+
"execution_count": 16,
237+
"metadata": {},
238+
"output_type": "execute_result"
239+
}
240+
],
241+
"source": [
242+
"study_minutes = np.zeros(100, np.uint16)\n",
243+
"study_minutes"
244+
]
245+
},
214246
{
215247
"cell_type": "code",
216248
"execution_count": null,
217249
"metadata": {},
218250
"outputs": [],
219251
"source": []
220252
},
253+
{
254+
"cell_type": "code",
255+
"execution_count": 17,
256+
"metadata": {},
257+
"outputs": [
258+
{
259+
"name": "stdout",
260+
"output_type": "stream",
261+
"text": [
262+
"Variable Type Data/Info\n",
263+
"------------------------------------\n",
264+
"gpas ndarray 4: 4 elems, type `float64`, 32 bytes\n",
265+
"gpas_as_list list n=4\n",
266+
"np module <module 'numpy' from '/Us<...>kages/numpy/__init__.py'>\n",
267+
"study_minutes ndarray 100: 100 elems, type `uint16`, 200 bytes\n"
268+
]
269+
}
270+
],
271+
"source": [
272+
"%whos"
273+
]
274+
},
275+
{
276+
"cell_type": "code",
277+
"execution_count": 15,
278+
"metadata": {},
279+
"outputs": [
280+
{
281+
"data": {
282+
"text/plain": [
283+
"1440"
284+
]
285+
},
286+
"execution_count": 15,
287+
"metadata": {},
288+
"output_type": "execute_result"
289+
}
290+
],
291+
"source": [
292+
"60 * 24"
293+
]
294+
},
295+
{
296+
"cell_type": "code",
297+
"execution_count": 18,
298+
"metadata": {},
299+
"outputs": [],
300+
"source": [
301+
"study_minutes[0] = 150"
302+
]
303+
},
304+
{
305+
"cell_type": "code",
306+
"execution_count": 19,
307+
"metadata": {},
308+
"outputs": [],
309+
"source": [
310+
"first_day_minutes = study_minutes[0]"
311+
]
312+
},
313+
{
314+
"cell_type": "code",
315+
"execution_count": 20,
316+
"metadata": {},
317+
"outputs": [
318+
{
319+
"data": {
320+
"text/plain": [
321+
"150"
322+
]
323+
},
324+
"execution_count": 20,
325+
"metadata": {},
326+
"output_type": "execute_result"
327+
}
328+
],
329+
"source": [
330+
"first_day_minutes"
331+
]
332+
},
333+
{
334+
"cell_type": "code",
335+
"execution_count": 21,
336+
"metadata": {},
337+
"outputs": [
338+
{
339+
"data": {
340+
"text/plain": [
341+
"numpy.uint16"
342+
]
343+
},
344+
"execution_count": 21,
345+
"metadata": {},
346+
"output_type": "execute_result"
347+
}
348+
],
349+
"source": [
350+
"type(first_day_minutes)"
351+
]
352+
},
353+
{
354+
"cell_type": "code",
355+
"execution_count": 22,
356+
"metadata": {},
357+
"outputs": [],
358+
"source": [
359+
"# TODO: Add 60 minutes to the second day in the study_minutes array\n",
360+
"study_minutes[1] = 60"
361+
]
362+
},
363+
{
364+
"cell_type": "code",
365+
"execution_count": 23,
366+
"metadata": {},
367+
"outputs": [
368+
{
369+
"data": {
370+
"text/plain": [
371+
"array([150, 60, 80, 60, 30, 90, 0, 0, 0, 0, 0, 0, 0,\n",
372+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
373+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
374+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
375+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
376+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
377+
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
378+
" 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=uint16)"
379+
]
380+
},
381+
"execution_count": 23,
382+
"metadata": {},
383+
"output_type": "execute_result"
384+
}
385+
],
386+
"source": [
387+
"study_minutes[2:6] = [80, 60, 30, 90]\n",
388+
"study_minutes"
389+
]
390+
},
221391
{
222392
"cell_type": "code",
223393
"execution_count": null,

0 commit comments

Comments
 (0)