Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.