|
72 | 72 | }, |
73 | 73 | { |
74 | 74 | "cell_type": "code", |
75 | | - "execution_count": 3, |
| 75 | + "execution_count": 48, |
76 | 76 | "metadata": { |
77 | 77 | "id": "n0m48JsS-nMC" |
78 | 78 | }, |
|
224 | 224 | "with open(all_paths[0], 'r') as f:\n", |
225 | 225 | " \n", |
226 | 226 | " # YOUR CODE HERE: Use the readline() or readlines() method to read the .csv file into a variable\n", |
227 | | - " print (f.readlines ()) \n", |
228 | | - "# I open the file 01.csv as a list\n", |
| 227 | + " print (f.readlines ())\n", |
| 228 | + " \n", |
| 229 | + " \n", |
| 230 | + "# I opened the file 01.csv into a variabe [as a list]\n", |
229 | 231 | " \n", |
230 | 232 | " \n", |
231 | 233 | " # YOUR CODE HERE: Iterate through the variable using a for loop and print each row for inspection\n", |
232 | 234 | "with open(all_paths[0], 'r') as f:\n", |
233 | 235 | " for i in range (60):\n", |
234 | 236 | " print(f. readline())\n", |
235 | | - "# I opened each line fo inspection " |
| 237 | + "# I opened each line for inspection using a for loop" |
236 | 238 | ] |
237 | 239 | }, |
238 | 240 | { |
|
266 | 268 | }, |
267 | 269 | { |
268 | 270 | "cell_type": "code", |
269 | | - "execution_count": 43, |
| 271 | + "execution_count": 49, |
270 | 272 | "metadata": { |
271 | 273 | "id": "82-bk4CBB1w4" |
272 | 274 | }, |
|
297 | 299 | " # If the operation is not one of the expected values, raise an error\n", |
298 | 300 | " raise ValueError(\"Invalid operation. Please choose 'mean', 'max', or 'min'.\")\n", |
299 | 301 | "\n", |
300 | | - " return summary_values\n" |
| 302 | + " return summary_values\n", |
| 303 | + "# explanation: based on the structure you provided and the lectures I defined the variable \"summary_values\" as the outcome of using one of the methods \n", |
| 304 | + "# (min, max, mean) on the array \"data\", while ax defined as 1 [row]" |
301 | 305 | ] |
302 | 306 | }, |
303 | 307 | { |
304 | 308 | "cell_type": "code", |
305 | | - "execution_count": 44, |
| 309 | + "execution_count": 50, |
306 | 310 | "metadata": {}, |
307 | 311 | "outputs": [ |
308 | 312 | { |
|
322 | 326 | }, |
323 | 327 | { |
324 | 328 | "cell_type": "code", |
325 | | - "execution_count": null, |
| 329 | + "execution_count": 51, |
326 | 330 | "metadata": {}, |
327 | 331 | "outputs": [ |
328 | 332 | { |
|
337 | 341 | " 6.725, 5.7 , 6.25 , 6.4 , 7.05 , 5.9 ])" |
338 | 342 | ] |
339 | 343 | }, |
340 | | - "execution_count": 29, |
| 344 | + "execution_count": 51, |
341 | 345 | "metadata": {}, |
342 | 346 | "output_type": "execute_result" |
343 | 347 | } |
|
349 | 353 | }, |
350 | 354 | { |
351 | 355 | "cell_type": "code", |
352 | | - "execution_count": 30, |
| 356 | + "execution_count": 52, |
353 | 357 | "metadata": {}, |
354 | 358 | "outputs": [ |
355 | 359 | { |
|
361 | 365 | " 0., 0., 0., 0., 0., 0., 0., 0., 0.])" |
362 | 366 | ] |
363 | 367 | }, |
364 | | - "execution_count": 30, |
| 368 | + "execution_count": 52, |
365 | 369 | "metadata": {}, |
366 | 370 | "output_type": "execute_result" |
367 | 371 | } |
|
372 | 376 | }, |
373 | 377 | { |
374 | 378 | "cell_type": "code", |
375 | | - "execution_count": 31, |
| 379 | + "execution_count": 53, |
376 | 380 | "metadata": {}, |
377 | 381 | "outputs": [ |
378 | 382 | { |
|
385 | 389 | " 17., 15., 17., 16., 17., 19., 18., 18.])" |
386 | 390 | ] |
387 | 391 | }, |
388 | | - "execution_count": 31, |
| 392 | + "execution_count": 53, |
389 | 393 | "metadata": {}, |
390 | 394 | "output_type": "execute_result" |
391 | 395 | } |
|
396 | 400 | }, |
397 | 401 | { |
398 | 402 | "cell_type": "code", |
399 | | - "execution_count": 46, |
| 403 | + "execution_count": 54, |
400 | 404 | "metadata": { |
401 | 405 | "id": "3TYo0-1SDLrd" |
402 | 406 | }, |
|
421 | 425 | " [17., 19., 18., 18.]])" |
422 | 426 | ] |
423 | 427 | }, |
424 | | - "execution_count": 46, |
| 428 | + "execution_count": 54, |
425 | 429 | "metadata": {}, |
426 | 430 | "output_type": "execute_result" |
427 | 431 | } |
428 | 432 | ], |
429 | 433 | "source": [ |
430 | 434 | "patient_summary (all_paths[0], 'max').reshape (15,4)\n", |
431 | | - "# here I used a method of array data type to organize the max matrix\n" |
| 435 | + "# here I used an array data type's method [reshape] to organize the max matrix\n" |
432 | 436 | ] |
433 | 437 | }, |
434 | 438 | { |
|
486 | 490 | }, |
487 | 491 | { |
488 | 492 | "cell_type": "code", |
489 | | - "execution_count": 33, |
| 493 | + "execution_count": 55, |
490 | 494 | "metadata": { |
491 | 495 | "id": "_svDiRkdIwiT" |
492 | 496 | }, |
|
509 | 513 | }, |
510 | 514 | { |
511 | 515 | "cell_type": "code", |
512 | | - "execution_count": null, |
| 516 | + "execution_count": 56, |
513 | 517 | "metadata": { |
514 | 518 | "id": "LEYPM5v4JT0i" |
515 | 519 | }, |
|
526 | 530 | " else:\n", |
527 | 531 | " return False\n", |
528 | 532 | " \n", |
529 | | - " # explanation: I defined x in the same way data_mean was defined. Then, based on your explanation tath the check_zeros\n", |
530 | | - " # function returns only boolean values, I defined the conditional." |
| 533 | + " # explanation: I defined x in the same way \"data_mean\" was defined above. Then, based on the explanation you provided on the check_zeros\n", |
| 534 | + " # function which returns only boolean values, I defined the conditional." |
531 | 535 | ] |
532 | 536 | }, |
533 | 537 | { |
534 | 538 | "cell_type": "code", |
535 | | - "execution_count": 40, |
| 539 | + "execution_count": 57, |
536 | 540 | "metadata": {}, |
537 | 541 | "outputs": [ |
538 | 542 | { |
|
551 | 555 | }, |
552 | 556 | { |
553 | 557 | "cell_type": "code", |
554 | | - "execution_count": null, |
| 558 | + "execution_count": 58, |
555 | 559 | "metadata": {}, |
556 | 560 | "outputs": [ |
557 | 561 | { |
|
565 | 569 | "source": [ |
566 | 570 | "print(detect_problems(all_paths[1]))\n", |
567 | 571 | "\n", |
568 | | - "## here I changed the all the values in row 60 in \"_02.csv\" to 0, and then test this file to chec my function" |
| 572 | + "## here I changed all the values in row 60 in \"_02.csv\" to 0, and then test this file to check my function" |
569 | 573 | ] |
570 | 574 | }, |
571 | 575 | { |
572 | 576 | "cell_type": "code", |
573 | | - "execution_count": 42, |
| 577 | + "execution_count": 59, |
574 | 578 | "metadata": {}, |
575 | 579 | "outputs": [ |
576 | 580 | { |
|
0 commit comments