customerDF.groupBy("state").agg(max($"discount").alias("newName"))
(or .as(...), both functions can take a String or a Symbol) On Tue, May 19, 2015 at 2:11 PM, Cesar Flores <ces...@gmail.com> wrote: > > I would like to ask if there is a way of specifying the column name of a > data frame aggregation. For example If I do: > > customerDF.groupBy("state").agg(max($"discount")) > > the name of my aggregated column will be: MAX('discount) > > Is there a way of changing the name of that column to something else on > the fly, and not after performing the aggregation? > > > thanks > -- > Cesar Flores >