U.S. Medical Insurance Costs category

Hello CodeCademy fellows!

I just finished the portfolio project of Python, and I am posting it here. I am glad I made it without looking for any help on the internet or on CodeCademy, but I also know this forum makes us keep growing and learning by your feedback.

Any comment or suggestion will be so appreciated!

I am giving you the link here:

Thanks in advance for any feedback!

Very good analysis. Thumbs up. Happy Coding.

1 Like

Hi @array2514492347,

Congrats on finishing up your project. Since you were looking for a bit of feedback-
You have quite a few classes that aren’t used like classes, they seem to be single use functions (single methods and no use of object itself). Consider whether there’s any benefit of actually wrapping them in a class in this case. A class wrapping all the data and containing some or all of those functions as methods on the other hand would make a bit more sense to me.

There seems to be more than one function/class to calculate the minimum or maximum of a dataset. Why not use the same function for age, bmi & charges etc.? Same for averages. Python’s built-ins, e.g. min, max and sum might be useful for this.

A couple of other functions could also be reduced in number (e.g. smoker / kids impact). They’re almost identical but for the data passed to them, perhaps you can find a way to make a single function which performs the same task?

There is some analysis on bmi that uses exact values. That is [bmi]==30.0 or similar which is an odd way to analyse data. Consider something like binning and histograms to better represent your data (e.g. 15.0 <= bmi <= 20.0 or something along those lines). You use binning at one point for charges which is good but why not bmi? Choosing exact values risks making outlying data seem more important than it is.
This section which seems to have an error somewhere kind of sums it up-
For a bmi of 15.96, the charge is $1694.7964.
For a bmi of 30.5, the charge is $4751.07.
For a bmi of 30.5, the charge is $12638.195.
For a bmi of 30.5, the charge is $2494.022.
For a bmi of 30.5, the charge is $10704.47.
For a bmi of 53.13, the charge is $1163.4627.

This is perhaps even more prevalent in the num_children data where you can either have 0, 1 or 3 children? Perhaps justify why you chose those particular values.

The conclusions section I like as it wraps things up nicely and you make good points about some of your conclusions e.g. the impact of age and smoking relative to the other factors which is good analysis. If you can make your code follow DRY a little more and perhaps clean up some of the actual data analysis then I think it would be improved, your actual conclusions seem reasonable.

1 Like

Thank you a lot for the feedback! I will definetely pay attention to all your comments