Seeking Feedback on Completed Project: U.S. Medical Insurance Costs Analysis

Hello friends, I just finished the Portfolio Project: U.S. Medical Insurance Costs. It is very important for me if you can see the code and give me your opinions. That way I can learn from my mistakes and improve.

The github link is Medical-Insurance-Analysis/us-medical-insurance-costs.ipynb at main · souder/Medical-Insurance-Analysis · GitHub

Thanks and sorry for the inconvenience.

Just a few observations:

  • The number of men and women in the dataset is incorrect. There are only 1338 records in the df. So, you have to tweak that function.
df.info()
>>
Data columns (total 7 columns):
 #   Column    Non-Null Count  Dtype  
---  ------    --------------  -----  
 0   age       1338 non-null   int64  
 1   sex       1338 non-null   object 
 2   bmi       1338 non-null   float64
 3   children  1338 non-null   int64  
 4   smoker    1338 non-null   object 
 5   region    1338 non-null   object 
 6   charges   1338 non-null   float64
dtypes: float64(2), int64(2), object(3)

df['sex'].value_counts()

>>male      676
female    662
  • The total number of people in each region is also incorrect. See:
df['region'].value_counts()

>>southeast    364
southwest    325
northwest    325
northeast    324
  • Maybe rather than look at the avg. charges, it might be better to look at the median b/c there are outliers that pull the mean of that column.

  • There are only 274 smokers in the dataframe, so you also have to tweak that function.

see:

df['smoker'].value_counts()

>> no     1064
yes     274

Fix those things and you should be good to go! :slight_smile:

1 Like

Thank you for taking the time to review the code and providing valuable corrections. I’ve implemented the suggested changes, and the counts for gender, region, and smoking status have been updated to accurately reflect the dataset. Your insights were instrumental in ensuring the accuracy of the analysis.

Regarding the calculation of the median, I’ve chosen to perform it without using libraries, aligning with the current content I am studying. Your guidance has been immensely helpful, and I appreciate your thorough review of the code. If there are any further recommendations or insights, I’d be more than happy to incorporate them. Thanks again! :slight_smile: :

1 Like