I have a dataframe(spark):
id value 3 0 3 1 3 0 4 1 4 0 4 0
I want to create a new dataframe:
3 0
You can simply use groupBy like this
groupBy
val df2 = df1.groupBy("id","value").count().select("id","value")
Here your df1 is
df1
And resultant dataframe is df2 which is your expected output like this
df2
id value 3 0 3 1 4 1 4 0