diff --git a/src/jupyter_contrib_nbextensions/nbextensions/snippets_menu/snippets_submenus_python/pandas.js b/src/jupyter_contrib_nbextensions/nbextensions/snippets_menu/snippets_submenus_python/pandas.js index b82ed3b4a..74994ba0e 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/snippets_menu/snippets_submenus_python/pandas.js +++ b/src/jupyter_contrib_nbextensions/nbextensions/snippets_menu/snippets_submenus_python/pandas.js @@ -113,7 +113,16 @@ define({ { 'name' : 'Combining', - 'snippet' : ['',], + 'sub-menu' : [ + { + 'name' : 'Split-apply-combine (sum)', + 'snippet' : ['df['label_count'] = df.groupby('label', as_index=False)['label'].transform(lambda x: x.count())',], + }, + { + 'name' : 'Split-apply-combine (mean)', + 'snippet' : ['df['label_mean'] = df.groupby('label', as_index=False)['label'].transform(lambda x: x.mean())',], + }, + ], }, {