You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by issues solution <is...@gmail.com> on 2017/04/14 13:07:12 UTC

create column with map function apply to dataframe

Hi ,
 how you can create column inside map function


like that :

df.map(lambd l : len(l) ) .....

but instead return rdd we create column insde data frame .

Re: create column with map function apply to dataframe

Posted by Ankur Srivastava <an...@gmail.com>.
If I understand your question you should look at withColumn of dataframe
api.

df.withColumn("len", len("l"))

Thanks
Ankur

On Fri, Apr 14, 2017 at 6:07 AM, issues solution <is...@gmail.com>
wrote:

> Hi ,
>  how you can create column inside map function
>
>
> like that :
>
> df.map(lambd l : len(l) ) .....
>
> but instead return rdd we create column insde data frame .
>