Skip to content

Python Assignment 2#353

Open
nicosarian wants to merge 2 commits intoUofT-DSI:mainfrom
nicosarian:assignment-2
Open

Python Assignment 2#353
nicosarian wants to merge 2 commits intoUofT-DSI:mainfrom
nicosarian:assignment-2

Conversation

@nicosarian
Copy link

What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)

Adding code to complete Assignment 2. This includes reading and displaying data from the first CSV file, creating the patient_summary() function to calculate mean, maximum, and minimum inflammation values for each patient, and creating the detect_problems() function to identify whether any patients have a mean inflammation score of 0.

What did you learn from the changes you have made?

I learned how to read CSV files in Python using both basic file handling and NumPy. I also learned how to write reusable functions, apply summary operations across rows of a dataset, and use helper functions to detect possible data issues. In addition, I improved my understanding of array operations and how to debug common Python errors such as indentation problems and variable naming issues.

Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?

One other approach I considered was using only basic Python with loops and lists for all calculations instead of using NumPy. However, NumPy was a better choice because it made the code shorter, clearer, and more efficient for calculating row-based statistics like mean, max, and min.

Were there any challenges? If so, what issue(s) did you face? How did you overcome it?

One challenge was fixing an indentation error caused by inconsistent spacing in Python. Another issue was a NameError caused by returning a variable name that had not been defined. I overcame these issues by carefully checking the indentation in each code block and making sure that the returned variable name matched the one used inside the function.

How were these changes tested?

The changes were tested by running the functions on the first inflammation CSV file. I verified that patient_summary(all_paths[0], 'min') returned an output of length 60, which matched the expected number of patients. I also tested the logic of the detect_problems() function by confirming that it correctly used patient_summary() together with check_zeros().

A reference to a related issue in your repository (if applicable)

N/A

Checklist

  • I can confirm that my changes are working as intended

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant