Skip to content

Instantly share code, notes, and snippets.

@siakon89
Created May 15, 2020 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siakon89/5c4ff88fdd14595b76524da0f6ee0b25 to your computer and use it in GitHub Desktop.
Save siakon89/5c4ff88fdd14595b76524da0f6ee0b25 to your computer and use it in GitHub Desktop.
# GroupBy a column and count
df.groupby("column").count().show()
# GroupBy a column and sum
df.groupby("column1").sum("column2").show()
# GroupBy with multiple columns
df.groupby("column1", "column2").count().show()
# GroupBy with multiple columns and sum multiple columns
df.groupby("column1", "column2").sum("column3", "column4").show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment