diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index c0303dd69..1ae6fe242 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -72,42 +72,11 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": null, "metadata": { "id": "n0m48JsS-nMC" }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0,0,1,3,1,2,4,7,8,3,3,3,10,5,7,4,7,7,12,18,6,13,11,11,7,7,4,6,8,8,4,4,5,7,3,4,2,3,0,0\n", - "\n", - "0,1,2,1,2,1,3,2,2,6,10,11,5,9,4,4,7,16,8,6,18,4,12,5,12,7,11,5,11,3,3,5,4,4,5,5,1,1,0,1\n", - "\n", - "0,1,1,3,3,2,6,2,5,9,5,7,4,5,4,15,5,11,9,10,19,14,12,17,7,12,11,7,4,2,10,5,4,2,2,3,2,2,1,1\n", - "\n", - "0,0,2,0,4,2,2,1,6,7,10,7,9,13,8,8,15,10,10,7,17,4,4,7,6,15,6,4,9,11,3,5,6,3,3,4,2,3,2,1\n", - "\n", - "0,1,1,3,3,1,3,5,2,4,4,7,6,5,3,10,8,10,6,17,9,14,9,7,13,9,12,6,7,7,9,6,3,2,2,4,2,0,1,1\n", - "\n", - "0,0,1,2,2,4,2,1,6,4,7,6,6,9,9,15,4,16,18,12,12,5,18,9,5,3,10,3,12,7,8,4,7,3,5,4,4,3,2,1\n", - "\n", - "0,0,2,2,4,2,2,5,5,8,6,5,11,9,4,13,5,12,10,6,9,17,15,8,9,3,13,7,8,2,8,8,4,2,3,5,4,1,1,1\n", - "\n", - "0,0,1,2,3,1,2,3,5,3,7,8,8,5,10,9,15,11,18,19,20,8,5,13,15,10,6,10,6,7,4,9,3,5,2,5,3,2,2,1\n", - "\n", - "0,0,0,3,1,5,6,5,5,8,2,4,11,12,10,11,9,10,17,11,6,16,12,6,8,14,6,13,10,11,4,6,4,7,6,3,2,1,0,0\n", - "\n", - "0,1,1,2,1,3,5,3,5,8,6,8,12,5,13,6,13,8,16,8,18,15,16,14,12,7,3,8,9,11,2,5,4,5,1,4,1,2,0,0\n", - "\n", - "0,1,0,0,4,3,3,5,5,4,5,8,7,10,13,3,7,13,15,18,8,15,15,16,11,14,12,4,10,10,4,3,4,5,5,3,3,2,2,1\n", - "\n", - "0,1,0,0,3,4,2,7,8,5,2,8,11,5,5,8,14,11,6,11,9,16,18,6,12,5,4,3,5,7,8,3,5,4,5,5,4,0,1,1\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "all_paths = [\n", " \"../../05_src/data/assignment_2_data/inflammation_01.csv\",\n", @@ -125,8 +94,6 @@ "]\n", "\n", "with open(all_paths[0], 'r') as f:\n", - " for i in range(12):\n", - " print(f.readline())\n", " # YOUR CODE HERE: Use the readline() or readlines() method to read the .csv file into a variable\n", " \n", " # YOUR CODE HERE: Iterate through the variable using a for loop and print each row for inspection" @@ -163,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 116, + "execution_count": null, "metadata": { "id": "82-bk4CBB1w4" }, @@ -178,13 +145,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", - " summary_values = np.mean(data, axis = ax)\n", + "\n", " elif operation == 'max':\n", " # YOUR CODE HERE: Calculate the maximum number of flare-ups experienced by each patient\n", - " summary_values = np.max(data, axis = ax)\n", + "\n", " elif operation == 'min':\n", " # YOUR CODE HERE: Calculate the minimum number of flare-ups experienced by each patient\n", - " summary_values = np.min(data, axis = ax)\n", + "\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", @@ -194,41 +161,16 @@ }, { "cell_type": "code", - "execution_count": 117, + "execution_count": null, "metadata": { "id": "3TYo0-1SDLrd" }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "60\n", - "[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", - " 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", - " 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n" - ] - } - ], + "outputs": [], "source": [ "# Test it out on the data file we read in and make sure the size is what we expect i.e., 60\n", "# Your output for the first file should be 60\n", "data_min = patient_summary(all_paths[0], 'min')\n", - "print(len(data_min))\n", - "\n", - "print(data_min) #sanity check" - ] - }, - { - "cell_type": "code", - "execution_count": 118, - "metadata": {}, - "outputs": [], - "source": [ - "#data_mean = patient_summary(all_paths[0], 'mean')\n", - "#print(len(data_mean))\n", - "\n", - "#print(data_mean) #san#ity check" + "print(len(data_min))" ] }, { @@ -286,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 119, + "execution_count": null, "metadata": { "id": "_svDiRkdIwiT" }, @@ -309,7 +251,7 @@ }, { "cell_type": "code", - "execution_count": 120, + "execution_count": null, "metadata": { "id": "LEYPM5v4JT0i" }, @@ -319,29 +261,19 @@ "\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", - " averages = patient_summary(file_path, 'mean')\n", - " myflag = check_zeros(averages)\n", - " return myflag" + "\n", + " return" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "False\n" - ] - } - ], + "outputs": [], "source": [ "# Test out your code here\n", "# Your output for the first file should be False\n", - "print(detect_problems(all_paths[0]))\n", - "#adding this to make sure I am submitting the correct version" + "print(detect_problems(all_paths[0]))" ] }, { @@ -382,8 +314,7 @@ "provenance": [] }, "kernelspec": { - "display_name": "python-env (3.11.14)", - "language": "python", + "display_name": "Python 3", "name": "python3" }, "language_info": { @@ -396,7 +327,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.14" + "version": "3.11.8" } }, "nbformat": 4,