Answers for "compute the average age for each gender? *"

0

compute the average age for each gender? *

In [51]: df.groupby('Gender', as_index=False).Age.mean()
Out[51]:
   Gender  Age
0  Female   18
1    Male   15
Posted by: Guest on May-10-2021
0

compute the average age for each gender? *

In [10]: titanic.groupby("Sex")["Age"].mean()
Out[10]: 
Sex
female    27.915709
male      30.726645
Name: Age, dtype: float64
Posted by: Guest on May-10-2021

Code answers related to "compute the average age for each gender? *"

Browse Popular Code Answers by Language