Problem: Calculating the mean male age yields ‘inf’.
My code seems to work on my local python environment but breaks in Gitpod. I can’t seem to calculate the average male age since adding up all the ages or using .mean() yields infinity. Using “df[df[‘sex’]==‘Male’][‘age’].mean().round(1)” yields “inf”. Using total_age = int(df.loc[df[‘sex’] == ‘Male’][‘age’].sum()) yields extremely large numbers. How can I fix this?
Thank you very much for reading,
Cheers!
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0
Challenge Information:
Data Analysis with Python Projects - Demographic Data Analyzer