Skip to content

Instantly share code, notes, and snippets.

@icexelloss
Created November 20, 2017 15:52
Show Gist options
  • Save icexelloss/26c3d8bacc41c77467f6ab23e91de65e to your computer and use it in GitHub Desktop.
Save icexelloss/26c3d8bacc41c77467f6ab23e91de65e to your computer and use it in GitHub Desktop.
sample = df.filter(id == 1).toPandas()
# Run as a standalone function on a pandas.DataFrame and verify result
subtract_mean.func(sample)
# Now run with Spark
df.groupby('id').apply(substract_mean)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment