Skip to content

Completing assignment 2#2

Open
Hossein-Bg wants to merge 3 commits intomainfrom
assignment-2
Open

Completing assignment 2#2
Hossein-Bg wants to merge 3 commits intomainfrom
assignment-2

Conversation

@Hossein-Bg
Copy link
Copy Markdown
Owner

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

In this assignment, we worked with a set of CSV files, iterated through their contents, and used those files in our functions. Additionally, we created functions and utilized the NumPy library to calculate the mean, minimum, and maximum of our data.

What did you learn from the changes you have made?

I learned how to work with files, how to read them, and how to create a function that is usable everywhere. I also became familiar with the NumPy library and its related built-in functions

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

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

The only challenge I encountered was with the paths of the CSV files. I’m not sure why, but I couldn't read the file paths in this format:
all_paths = [
"../05_src/data/assignment_2_data/inflammation_01.csv",
"../05_src/data/assignment_2_data/inflammation_02.csv",
"../05_src/data/assignment_2_data/inflammation_03.csv",
"../05_src/data/assignment_2_data/inflammation_04.csv",
"../05_src/data/assignment_2_data/inflammation_05.csv",
"../05_src/data/assignment_2_data/inflammation_06.csv",
"../05_src/data/assignment_2_data/inflammation_07.csv",
"../05_src/data/assignment_2_data/inflammation_08.csv",
"../05_src/data/assignment_2_data/inflammation_09.csv",
"../05_src/data/assignment_2_data/inflammation_10.csv",
"../05_src/data/assignment_2_data/inflammation_11.csv",
"../05_src/data/assignment_2_data/inflammation_12.csv"
]

So I had to change it to this format :

all_paths = [
"../../05_src/data/assignment_2_data/inflammation_01.csv",
"../../05_src/data/assignment_2_data/inflammation_02.csv",
"../../05_src/data/assignment_2_data/inflammation_03.csv",
"../../05_src/data/assignment_2_data/inflammation_04.csv",
"../../05_src/data/assignment_2_data/inflammation_05.csv",
"../../05_src/data/assignment_2_data/inflammation_06.csv",
"../../05_src/data/assignment_2_data/inflammation_07.csv",
"../../05_src/data/assignment_2_data/inflammation_08.csv",
"../../05_src/data/assignment_2_data/inflammation_09.csv",
"../../05_src/data/assignment_2_data/inflammation_10.csv",
"../../05_src/data/assignment_2_data/inflammation_11.csv",
"../../05_src/data/assignment_2_data/inflammation_12.csv"
]

How were these changes tested?

By testing the functions with different samples, we can ensure they work as expected.

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

Checklist

  • [✔] I can confirm that my changes are working as intended

Copy link
Copy Markdown

@pedram-aliniaye-asli pedram-aliniaye-asli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did a great job here!
Just a quick note:

  • In this block of code:
  if zeros_detector == True:
    return("True, at least one patient has a mean inflammation score of 0")
  else:
    return("False, no patient has a mean inflammation score of 0")

You are returning two strings as a result. It is better to return the result as a value, like a boolean data such as True or False. Then, if you want you can print these strings based on the returned result.

Please go ahead and do the modifications and then let me know. Thanks!

@pedram-aliniaye-asli
Copy link
Copy Markdown

Your modification changed the code, but actually, the logic is the same again.

if zeros_detector == True:
    return(True, "at least one patient has a mean inflammation score of 0")
  else:
    return(False, "no patient has a mean inflammation score of 0")

Now, You can just simply return the result of check_zeros function (zeros_detector) instead of making an if statement. This if statement will return True if the result is true and False if the result is false, which is redundant. Then you can use the returned result to produce any strings as you want.

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.

2 participants