diff --git a/ml2/3_4_Visualisation_Pandas.ipynb b/ml2/3_4_Visualisation_Pandas.ipynb index ad31777..d69e90b 100644 --- a/ml2/3_4_Visualisation_Pandas.ipynb +++ b/ml2/3_4_Visualisation_Pandas.ipynb @@ -478,9 +478,7 @@ "outputs": [], "source": [ "# 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", - " \n", - " stacked=True) " + "df.query('Age < 20 and Survived == 1').groupby(['Sex','Pclass']).size().unstack(['Sex']).plot(kind='bar', stacked=True) " ] }, { @@ -493,6 +491,7 @@ "\n", "pclass_labels = ['First', 'Second', 'Third']\n", "sex_labels = {'Female': 0, 'Male': 1}\n", + "sex_labels = ['Female', 'Male']\n", "\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", @@ -511,6 +510,7 @@ "#The same horizontal\n", "pclass_labels = ['First', 'Second', 'Third']\n", "sex_labels = {'Female': 0, 'Male': 1}\n", + "sex_labels = ['Female', 'Male']\n", "\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",