From 08d167ea15cf1f027a8b94366f099330dfcfe454 Mon Sep 17 00:00:00 2001 From: Doris Lee Date: Wed, 11 Nov 2020 14:32:52 +0800 Subject: [PATCH] replace agg("count") with .count() --> ~0.1ms speedup --- lux/executor/PandasExecutor.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lux/executor/PandasExecutor.py b/lux/executor/PandasExecutor.py index 768bbe02..30af5e0f 100644 --- a/lux/executor/PandasExecutor.py +++ b/lux/executor/PandasExecutor.py @@ -358,9 +358,7 @@ def execute_2D_binning(vis: Vis): result = result.dropna() else: groups = vis._vis_data.groupby(["xBin", "yBin"])[x_attr] - result = groups.agg("count").reset_index( - name=x_attr - ) # .agg in this line throws SettingWithCopyWarning + result = groups.count().reset_index(name=x_attr) result = result.rename(columns={x_attr: "count"}) result = result[result["count"] != 0]