From 34cdf345b5b0e58727e5f2943b484921644ba9a8 Mon Sep 17 00:00:00 2001 From: Steven DeMartini <1647130+sjdemartini@users.noreply.github.com> Date: Thu, 13 Apr 2023 13:57:36 -0700 Subject: [PATCH] Fix syntax error in snippets_menu pandas.js that breaks SnippetsMenu There was a syntax error introduced to the snippets in commit d0fb8668c1158fd17a803ebd3fda0b01014b7021, since it attempted to use single quotes within a single-quoted string. Without this fix, the Snippets menu would entirely fail to load if the built-in Pandas snippets are included (as is the default), with the dev tools console reporting `Uncaught SyntaxError: Unexpected identifier 'label_count' (at pandas.js?v=20230413134100:119:39) 13:49:07.959 `. --- .../snippets_menu/snippets_submenus_python/pandas.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 74994ba0e..950b3e777 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 @@ -116,11 +116,11 @@ define({ 'sub-menu' : [ { 'name' : 'Split-apply-combine (sum)', - 'snippet' : ['df['label_count'] = df.groupby('label', as_index=False)['label'].transform(lambda x: x.count())',], + '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())',], + 'snippet' : ['df["label_mean"] = df.groupby("label", as_index=False)["label"].transform(lambda x: x.mean())',], }, ], },