# First Portfoli project

This is a really easy exercise, with a wide freedom to explore some knowledge related to pandas and numpy.

U.S. Medical Insurance Costs
import pandas as pd
import numpy as np
import csv

df = pd.read_csv(r’C:\00 Proyecto The Gender Bender\Python\Practica\Health insurance project\python-portfolio-project-starter-files\insurance.csv’)

age sex bmi children smoker region charges
0 19 female 27.900 0 yes southwest 16884.92400
1 18 male 33.770 1 no southeast 1725.55230
2 28 male 33.000 3 no southeast 4449.46200
3 33 male 22.705 0 no northwest 21984.47061
4 32 male 28.880 0 no northwest 3866.85520

age
age = np.array(df.age)
media = np.mean(age)
media = np.mean(age)
text = 'La edad media de alguien con seguro es '+ str(media.round())
text = 'La edad media de alguien con seguro es '+ str(media.round())
xt
print(text)
La edad media de alguien con seguro es 39.0
import matplotlib as plt
import matplotlib
import matplotlib.pyplot as plt
agefemale =
agemale =
for i in range(len(df.sex)):
if df.sex[i] == ‘female’:
agefemale.append(df.age[i])
else:
agemale.append(df.age[i])

2
media = np.mean(agefemale)

text = 'La edad media de una mujer con seguro es '+ str(media.round())

print(text)
media = np.mean(agemale)
text2 = 'La edad media de un hombre con seguro es '+ str(media.round())
print(text2)
La edad media de una mujer con seguro es 40.0
La edad media de un hombre con seguro es 39.0

plt.hist(agemale, bins = 10, color = ‘green’)
plt.hist(agefemale, bins = 10, alpha = 0.8, color = ‘skyblue’)

plt.show()

1 Like

Hey there @roberspain! Thanks for posting. Quick tip– be sure to format your code properly so it’s easy to read for potential helpers. You can edit your post to do so by highlighting all your code and then clicking on the `</>` icon above. You can also reference this guide: [How-to] Create a topic that everyone will read

Hi Lily, thanks for comment.

I am trying to find </>

Although, next time I will work in GibHub.

Thanks.