Skip to content

Commit

Permalink
replace agg("count") with .count() --> ~0.1ms speedup
Browse files Browse the repository at this point in the history
  • Loading branch information
dorisjlee committed Nov 11, 2020
1 parent b6a7dd6 commit 08d167e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lux/executor/PandasExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 08d167e

Please sign in to comment.