R. Rajkumar movie HD full download
R. Rajkumar full movie
R. Rajkumar hindi dubbed movie
R. Rajkumar full movie HD
R. Rajkumar full movie download
R. Rajkumar full movie online
Category:Indian films
Category:Hindi-language films
Category:Hindi-language Netflix original programming
Category:Films directed by Prabhudeva
Category:Films shot in IndiaQ:
Spark MLLib: How to make transformations using GroupedData?
I have a dataframe:
+-------+---------+------------+
| id| user| message|
+-------+---------+------------+
|1015213| user1| Hello, world|
| 2| user2| Hello, again|
| 3| user3| Thank you for|
| 4| user4| the class|
+-------+---------+------------+
I want to group by id, and count the number of times a user sends a message. I have:
var countBy = df.groupBy("id").count().withColumn("messageCount", lit("messageCount"))
The result should be:
+-------+-----------------+------------+
| id| messageCount| message|
+-------+-----------------+------------+
|1015213| 1| Hello, world|
+-------+-----------------+------------+
When I do the transform, I'm getting the number of unique messages:
var countBy = df.groupBy("id").count().withColumn("messageCount", lit("messageCount"))
.transform(func.countDistinct("message"))
The result is:
+-------+---------+------------+
| id|messageCount| message|
+-------+------------+------------+
|1015213| be359ba680
Related links:
Comments