mirror of
https://github.com/gsi-upm/sitc
synced 2024-11-22 06:22:29 +00:00
minor fixes in ml2/3_4
This commit is contained in:
parent
b3239cbbab
commit
0aa095b40d
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user