From 5db6ea8e87414cf0da2176279f268d032a044d51 Mon Sep 17 00:00:00 2001 From: Phillip Antony Date: Tue, 27 Aug 2024 09:21:43 -0500 Subject: [PATCH] Update 100-pandas-puzzles-with-solutions.ipynb df.loc[:, ['animal', 'age', 'visits']].groupby(['animal', 'visits'], as_index= False).mean() adjusted the pivot table to reflect the desired answer. --- 100-pandas-puzzles-with-solutions.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/100-pandas-puzzles-with-solutions.ipynb b/100-pandas-puzzles-with-solutions.ipynb index 0b5927d3d..7fa348047 100644 --- a/100-pandas-puzzles-with-solutions.ipynb +++ b/100-pandas-puzzles-with-solutions.ipynb @@ -413,7 +413,7 @@ "metadata": {}, "outputs": [], "source": [ - "df.pivot_table(index='animal', columns='visits', values='age', aggfunc='mean')" + "df.loc[:, ['animal', 'age', 'visits']].groupby(['animal', 'visits'], as_index= False).mean()" ] }, {