From 0c43d538f51edfc71586b6541274fc73d625dfbd Mon Sep 17 00:00:00 2001 From: Jelle Treep <40466121+jelletreep@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:40:57 +0100 Subject: [PATCH] update plotting grouped data --- book/data-science-with-pandas-4.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/data-science-with-pandas-4.ipynb b/book/data-science-with-pandas-4.ipynb index f595b92..0826e20 100644 --- a/book/data-science-with-pandas-4.ipynb +++ b/book/data-science-with-pandas-4.ipynb @@ -470,8 +470,8 @@ "source": [ "fig, ax = plt.subplots()\n", "\n", - "for i, group in list(surveys.groupby('sex')):\n", - " ax.scatter(group['hindfoot_length'], group['weight'], alpha=0.5, label = group['sex'].iloc[0])\n", + "for item, group in list(surveys.groupby('sex')):\n", + " ax.scatter(group['hindfoot_length'], group['weight'], alpha=0.5, label = item)\n", " \n", "ax.legend(title='sex')\n", "ax.grid()\n",