Re: Use derived column for other derived column in the same statement

2019-04-22 Thread Vipul Rajan
Hi Rishi, TL;DR Using Scala, this would work df.withColumn("derived1", lit("something")).withColumn("derived2", col("derived1") === "something") just note that I used 3 equal to signs instead of just two. That should be enough, if you want to understand why read further. so "==" gives boolean

Re: Use derived column for other derived column in the same statement

2019-04-21 Thread Shraddha Shah
Also the same thing for groupby agg operation, how can we use one aggregated result (say min(amount)) to derive another aggregated column? On Sun, Apr 21, 2019 at 11:24 PM Rishi Shah wrote: > Hello All, > > How can we use a derived column1 for deriving another column in the same > dataframe

Use derived column for other derived column in the same statement

2019-04-21 Thread Rishi Shah
Hello All, How can we use a derived column1 for deriving another column in the same dataframe operation statement? something like: df = df.withColumn('derived1', lit('something')) .withColumn('derived2', col('derived1') == 'something') -- Regards, Rishi Shah