Data Analysis - Medical Data Visualizer troubleshooting

I see in the recommended topics next to this one that someone asked about my specific problem in November of 2022 and didn’t appear to get any response but I’m hopeful someone will point me in the right direction.
In the medical data visualizer project, it says " The dataset should be split by ‘Cardio’ so there is one chart for each cardio value." but when you actually get into the code in replit, because of the wording it seems you have to merge 2 separate dataframes , or do a groupby on a column that doesn’t exist in the melted dataframe that you created in the previous step. Is it possible that there are mistyped instructions and you add the cardio column into the df_cat in the melting of the data or is there some other way to sort the data that I need to still do more research on? Any pointers would be helpful as I’ve been at this particular segment for hours.

I don’t understand your question. There is a cardio column in the dataset. You have to make a pair of bar graphs, one for cardio = 0 and one for cardio = 1 like the example. You have to convert the data in the dataset into frequency data appropriate for creating the bar graphs in the example.

The segment that says “Create DataFrame for cat plot using pd.melt using just the values from ‘cholesterol’, ‘gluc’, ‘smoke’, ‘alco’, ‘active’, and ‘overweight’” suggested to me that the cardio column was not to be included in the melting of the data. I have found a different method that would likely work that doesn’t use pd.melt but was unsure of whether there is a strict rigidity to the process or if the process is not so important, so long as I can explain my process and get the resulting pair of bar graphs.

The tests only check the properties of the generated graphs, so feel free to code it as you wish. Technically, you don’t even have to use pandas and seaborn as long as you create the plots as correctly constructed matplotlib objects.

I think the code comment means that the other data will be included in the graph as bars, but since you are creating a pair of graphs with one having cardio = 0 and the other cardio = 1 then you won’t be including value counts of cardio to create bars.

Thank you, that made it clearer. Much appreciated

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.