: Re: Rename Several Aggregated Columns
One way is to rename the columns using the toDF
For eg:
val df = Seq((1, 2),(1,4),(2,3) ).toDF("a","b")
df.printSchema()
val renamedf = df.groupBy('a).agg(sum('b)).toDF("mycola", "mycolb")
renamedf.printSchema(
One way is to rename the columns using the toDF
For eg:
val df = Seq((1, 2),(1,4),(2,3) ).toDF("a","b")
df.printSchema()
val renamedf = df.groupBy('a).agg(sum('b)).toDF("mycola", "mycolb")
renamedf.printSchema()
Best regards,
Sunitha
> On Mar 18, 2016, at 9:10 AM,