diff --git a/applications/pandas/pandas.ipynb b/applications/pandas/pandas.ipynb index 69e390f8e11e98c96404072867ddc61d66d3054b..1245aaef9b4ee333e1bea90787b8a823193e0223 100644 --- a/applications/pandas/pandas.ipynb +++ b/applications/pandas/pandas.ipynb @@ -963,7 +963,7 @@ "metadata": {}, "outputs": [], "source": [ - "titanic.groupby(['class', 'survived']).aggregate((np.median, mad))" + "titanic.groupby(['class', 'survived']).aggregate((np.median, 'mad'))" ] }, { @@ -984,7 +984,7 @@ "metadata": {}, "outputs": [], "source": [ - "df_full = titanic.groupby(['class', 'survived']).aggregate((np.median, mad))" + "df_full = titanic.groupby(['class', 'survived']).aggregate((np.median, 'mad'))" ] }, { diff --git a/applications/pandas/pandas.md b/applications/pandas/pandas.md index d7914fb0dfb4abd8569f3de92d9ed4162963d2dd..76dd30c74254105c8e62cb160bcf713a3822b89c 100644 --- a/applications/pandas/pandas.md +++ b/applications/pandas/pandas.md @@ -462,7 +462,7 @@ titanic.groupby(['class', pd.cut(titanic.age, bins=(0, 18, 50, np.inf))]).mean() We can use the `aggregate` method to apply a different function to each series ``` -titanic.groupby(['class', 'survived']).aggregate((np.median, mad)) +titanic.groupby(['class', 'survived']).aggregate((np.median, 'mad')) ``` Note that both the index (on the left) and the column names (on the top) now @@ -473,7 +473,7 @@ The short version is that columns can be selected using direct indexing (as discussed above) ``` -df_full = titanic.groupby(['class', 'survived']).aggregate((np.median, mad)) +df_full = titanic.groupby(['class', 'survived']).aggregate((np.median, 'mad')) ``` ```