Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions 02_activities/assignments/assignment_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@
"\n",
"with open(all_paths[0], 'r') as f:\n",
" # YOUR CODE HERE: Use the readline() or readlines() method to read the .csv file into a variable\n",
" \n",
"\n",
"with open(all_paths[0], 'r') as f:\n",
" rows = f.readlines() # read all lines from the CSV\n",
"\n",
" for row in rows:\n",
" print(row.strip()) # print each row neatly\n",
" # YOUR CODE HERE: Iterate through the variable using a for loop and print each row for inspection"
]
},
Expand Down Expand Up @@ -145,13 +150,13 @@
" # Implement the specific operation based on the 'operation' argument\n",
" if operation == 'mean':\n",
" # YOUR CODE HERE: Calculate the mean (average) number of flare-ups for each patient\n",
"\n",
" summary_values = np.mean(data, axis=ax)\n",
" elif operation == 'max':\n",
" # YOUR CODE HERE: Calculate the maximum number of flare-ups experienced by each patient\n",
"\n",
" summary_values = np.max(data, axis=ax)\n",
" elif operation == 'min':\n",
" # YOUR CODE HERE: Calculate the minimum number of flare-ups experienced by each patient\n",
"\n",
" summary_values = np.min(data, axis=ax)\n",
" else:\n",
" # If the operation is not one of the expected values, raise an error\n",
" raise ValueError(\"Invalid operation. Please choose 'mean', 'max', or 'min'.\")\n",
Expand Down Expand Up @@ -261,8 +266,8 @@
"\n",
"def detect_problems(file_path):\n",
" #YOUR CODE HERE: Use patient_summary() to get the means and check_zeros() to check for zeros in the means\n",
"\n",
" return"
" mean_values = patient_summary(file_path, 'mean')\n",
" return check_zeros(mean_values)"
]
},
{
Expand Down