Hi,
This is my medical Insurance project. Any feedback is welcome, please!
It probably took me a couple of days to complete. I enjoyed this one, it was nice to work on some real data - I struggled to include classes, so think it can be more efficient than it is now
Python-Portfolio-Project—Medical-Insurance-Costs/CURRENT Medical Insurance Project 2.ipynb at main · captain-81/Python-Portfolio-Project—Medical-Insurance-Costs (github.com)
Thanks
I really like how your print statements present the data, it makes it very easy to read. Great job on that!
Since a function is meant to be run on many different data, the print statements that describe trends such as “The data is roughly evenly split by gender” should not be in the function itself but either outside the function or in a Markdown cell.
I also noticed a lot of the code looks very repetitive and I think you could maybe have 1 function that accepts more parameters that way you can re run the function for different “factors”. For Example:
def avg_insurance_costs_age(data_file, parameter1, parameter2, parameter3, etc):
for record in data_file:
if float(record[parameter1]) >= 18 and float(record[parameter1]) <= 25 and record[parameter2] == parameter3:
parameter3_charges_18_25 += float(record['parameter4'])
parameter3_count_18_25 += 1
to replace:
elif float(record['age']) >= 26 and float(record['age']) <= 35 and record['sex'] == 'male':
male_charges_26_35 += float(record['charges'])
male_count_26_35 += 1
This analysis was very, very thorough and I especially liked that you were able to break down statistics even more by including age brackets.
Overall there are a lot of functions here and I think a goal should be to have fewer functions with more interchangeable parameters but still get the same amount of analysis.
Great job overall.
Thanks for the feedback and the suggestions, its much appreciated! I will look at incorporating them into my analysis. I’m going to start the python fundamentals again as I got a bit derailed, so will probably do the analysis again, thanks again