|
72 | 72 | }, |
73 | 73 | { |
74 | 74 | "cell_type": "code", |
75 | | - "execution_count": 1, |
| 75 | + "execution_count": 3, |
76 | 76 | "metadata": { |
77 | 77 | "id": "n0m48JsS-nMC" |
78 | 78 | }, |
|
260 | 260 | }, |
261 | 261 | { |
262 | 262 | "cell_type": "code", |
263 | | - "execution_count": 14, |
| 263 | + "execution_count": 8, |
264 | 264 | "metadata": { |
265 | 265 | "id": "82-bk4CBB1w4" |
266 | 266 | }, |
267 | 267 | "outputs": [], |
268 | 268 | "source": [ |
269 | 269 | "import numpy as np\n", |
270 | 270 | "\n", |
271 | | - "def patient_summary(file_path, operation):\n", |
272 | | - " data = np.loadtxt(fname=file_path, delimiter=',') # Load the data from the file\n", |
| 271 | + "def patient_summary(all_paths, operation) -> np.ndarray:\n", |
| 272 | + " data = np.loadtxt(fname=all_paths, delimiter=',') # Load the data from the file\n", |
273 | 273 | " axis = 1 # This specifies that the operation should be done for each row (patient)\n", |
274 | 274 | "\n", |
275 | 275 | " # Implement the specific operation based on the 'operation' argument\n", |
|
293 | 293 | " f\"from data with shape {data.shape}.\"\n", |
294 | 294 | " )\n", |
295 | 295 | " return summary_values\n", |
296 | | - " \n", |
297 | | - "\n", |
298 | | - "\n", |
299 | | - " \n", |
300 | 296 | "\n" |
301 | 297 | ] |
302 | 298 | }, |
303 | 299 | { |
304 | 300 | "cell_type": "code", |
305 | | - "execution_count": 12, |
| 301 | + "execution_count": 10, |
306 | 302 | "metadata": { |
307 | 303 | "id": "3TYo0-1SDLrd" |
308 | 304 | }, |
|
311 | 307 | "name": "stdout", |
312 | 308 | "output_type": "stream", |
313 | 309 | "text": [ |
314 | | - "60\n", |
315 | | - "60\n", |
316 | | - "60\n" |
| 310 | + "[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n", |
| 311 | + " 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n", |
| 312 | + " 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n", |
| 313 | + "[5.45 5.425 6.1 5.9 5.55 6.225 5.975 6.65 6.625 6.525 6.775 5.8\n", |
| 314 | + " 6.225 5.75 5.225 6.3 6.55 5.7 5.85 6.55 5.775 5.825 6.175 6.1\n", |
| 315 | + " 5.8 6.425 6.05 6.025 6.175 6.55 6.175 6.35 6.725 6.125 7.075 5.725\n", |
| 316 | + " 5.925 6.15 6.075 5.75 5.975 5.725 6.3 5.9 6.75 5.925 7.225 6.15\n", |
| 317 | + " 5.95 6.275 5.7 6.1 6.825 5.975 6.725 5.7 6.25 6.4 7.05 5.9 ]\n", |
| 318 | + "[18. 18. 19. 17. 17. 18. 17. 20. 17. 18. 18. 18. 17. 16. 17. 18. 19. 19.\n", |
| 319 | + " 17. 19. 19. 16. 17. 15. 17. 17. 18. 17. 20. 17. 16. 19. 15. 15. 19. 17.\n", |
| 320 | + " 16. 17. 19. 16. 18. 19. 16. 19. 18. 16. 19. 15. 16. 18. 14. 20. 17. 15.\n", |
| 321 | + " 17. 16. 17. 19. 18. 18.]\n" |
317 | 322 | ] |
318 | 323 | } |
319 | 324 | ], |
320 | 325 | "source": [ |
321 | 326 | "# Test it out on the data file we read in and make sure the size is what we expect i.e., 60\n", |
322 | 327 | "# Your output for the first file should be 60\n", |
323 | 328 | "data_min = patient_summary(all_paths[0], 'min')\n", |
324 | | - "print(len(data_min))\n", |
| 329 | + "print(data_min)\n", |
325 | 330 | "\n", |
326 | 331 | "data_mean = patient_summary(all_paths[0], 'mean')\n", |
327 | | - "print(len(data_mean))\n", |
| 332 | + "print(data_mean)\n", |
328 | 333 | "\n", |
329 | 334 | "data_max = patient_summary(all_paths[0], 'max')\n", |
330 | | - "print(len(data_max))\n", |
331 | | - "\n" |
| 335 | + "print(data_max)\n" |
332 | 336 | ] |
333 | 337 | }, |
334 | 338 | { |
|
0 commit comments