1
0
mirror of https://github.com/gsi-upm/sitc synced 2024-11-21 14:02:28 +00:00

Update 3_3_Data_Munging_with_Pandas.ipynb

Se utiliza np.size en la última columna. Esto calcula el tamaño de la serie, creo que de valores no null, pero no lo que pienso que se pretende es calcular el número de supervivientes, para lo que se podría utilizar np.sum.
This commit is contained in:
Dani Vera 2019-09-18 15:39:16 +02:00 committed by GitHub
parent 2c8238f1f2
commit 344e054ba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,7 +437,7 @@
"\n",
"#Show mean Age, mean SibSp, and number of passengers older than 25 that survived, grouped by Passenger Class and Sex\n",
"df[(df.Age > 25 & (df.Survived == 1))].groupby(['Pclass', 'Sex'])['Age','SibSp','Survived'].agg({'Age': np.mean, \n",
" 'SibSp': np.mean, 'Survived': np.size})"
" 'SibSp': np.mean, 'Survived': np.sum})"
]
},
{