Skip to content

Commit a580118

Browse files
authored
fix(curriculum): medical data visualizer missing instructions (freeCodeCamp#56779)
1 parent 7ee5ac0 commit a580118

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/medical-data-visualizer.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,32 @@ File name: medical_examination.csv
4343

4444

4545
## Instructions
46+
47+
Create a chart similar to `examples/Figure_1.png`, where we show the counts of good and bad outcomes for the `cholesterol`, `gluc`, `alco`, `active`, and `smoke` variables for patients with `cardio=1` and `cardio=0` in different panels.
48+
4649
By each number in the `medical_data_visualizer.py` file, add the code from the associated instruction number below.
4750

48-
1. Import the data from `medical_examination.csv` and assign it to the `df` variable
51+
1. Import the data from `medical_examination.csv` and assign it to the `df` variable.
4952
2. Add an `overweight` column to the data. To determine if a person is overweight, first calculate their BMI by dividing their weight in kilograms by the square of their height in meters. If that value is > 25 then the person is overweight. Use the value `0` for NOT overweight and the value `1` for overweight.
5053
3. Normalize data by making `0` always good and `1` always bad. If the value of `cholesterol` or `gluc` is 1, set the value to `0`. If the value is more than `1`, set the value to `1`.
51-
4. Draw the Categorical Plot in the `draw_cat_plot` function
54+
4. Draw the Categorical Plot in the `draw_cat_plot` function.
5255
5. Create a DataFrame for the cat plot using `pd.melt` with values from `cholesterol`, `gluc`, `smoke`, `alco`, `active`, and `overweight` in the `df_cat` variable.
5356
6. Group and reformat the data in `df_cat` to split it by `cardio`. Show the counts of each feature. You will have to rename one of the columns for the `catplot` to work correctly.
54-
7. Convert the data into `long` format and create a chart that shows the value counts of the categorical features using the following method provided by the seaborn library import : `sns.catplot()`
55-
8. Get the figure for the output and store it in the `fig` variable
56-
9. Do not modify the next two lines
57-
10. Draw the Heat Map in the `draw_heat_map` function
57+
7. Convert the data into `long` format and create a chart that shows the value counts of the categorical features using the following method provided by the seaborn library import: `sns.catplot()`.
58+
8. Get the figure for the output and store it in the `fig` variable.
59+
9. Do not modify the next two lines.
60+
10. Draw the Heat Map in the `draw_heat_map` function.
5861
11. Clean the data in the `df_heat` variable by filtering out the following patient segments that represent incorrect data:
5962
- diastolic pressure is higher than systolic (Keep the correct data with `(df['ap_lo'] <= df['ap_hi'])`)
6063
- height is less than the 2.5th percentile (Keep the correct data with `(df['height'] >= df['height'].quantile(0.025))`)
6164
- height is more than the 97.5th percentile
6265
- weight is less than the 2.5th percentile
6366
- weight is more than the 97.5th percentile
64-
12. Calculate the correlation matrix and store it in the `corr` variable
65-
13. Generate a mask for the upper triangle and store it in the `mask` variable
66-
14. Set up the `matplotlib` figure
67-
15. Plot the correlation matrix using the method provided by the `seaborn` library import: `sns.heatmap()`
68-
16. Do not modify the next two lines
67+
12. Calculate the correlation matrix and store it in the `corr` variable.
68+
13. Generate a mask for the upper triangle and store it in the `mask` variable.
69+
14. Set up the `matplotlib` figure.
70+
15. Plot the correlation matrix using the method provided by the `seaborn` library import: `sns.heatmap()`.
71+
16. Do not modify the next two lines.
6972

7073
## Development
7174

0 commit comments

Comments
 (0)