1
0
mirror of https://github.com/gsi-upm/sitc synced 2024-11-21 22:12:30 +00:00

minor fixes in ml2/3_4

This commit is contained in:
Oscar Araque 2019-03-06 19:21:12 +01:00
parent b3239cbbab
commit 0aa095b40d

View File

@ -478,9 +478,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Now we make that the plot shows both values combined, and change the labels\n", "# Now we make that the plot shows both values combined, and change the labels\n",
"df.query('Age < 20 and Survived == 1').groupby(['Sex','Pclass']).size().unstack(['Sex']).plot(kind='bar', \\\n", "df.query('Age < 20 and Survived == 1').groupby(['Sex','Pclass']).size().unstack(['Sex']).plot(kind='bar', stacked=True) "
" \n",
" stacked=True) "
] ]
}, },
{ {
@ -493,6 +491,7 @@
"\n", "\n",
"pclass_labels = ['First', 'Second', 'Third']\n", "pclass_labels = ['First', 'Second', 'Third']\n",
"sex_labels = {'Female': 0, 'Male': 1}\n", "sex_labels = {'Female': 0, 'Male': 1}\n",
"sex_labels = ['Female', 'Male']\n",
"\n", "\n",
"plt = df.query('Age < 20 and Survived == 1').groupby(['Sex','Pclass']).size().unstack(['Sex']).plot(kind='bar', \n", "plt = df.query('Age < 20 and Survived == 1').groupby(['Sex','Pclass']).size().unstack(['Sex']).plot(kind='bar', \n",
" stacked=True, rot=0, subplots=False, figsize=(5,10))\n", " stacked=True, rot=0, subplots=False, figsize=(5,10))\n",
@ -511,6 +510,7 @@
"#The same horizontal\n", "#The same horizontal\n",
"pclass_labels = ['First', 'Second', 'Third']\n", "pclass_labels = ['First', 'Second', 'Third']\n",
"sex_labels = {'Female': 0, 'Male': 1}\n", "sex_labels = {'Female': 0, 'Male': 1}\n",
"sex_labels = ['Female', 'Male']\n",
"\n", "\n",
"plt = df.query('Age > 25 and Survived == 1').groupby(['Sex','Pclass']).size().unstack(['Sex']).plot(kind='barh', \n", "plt = df.query('Age > 25 and Survived == 1').groupby(['Sex','Pclass']).size().unstack(['Sex']).plot(kind='barh', \n",
" stacked=True, rot=0, subplots=False)\n", " stacked=True, rot=0, subplots=False)\n",