spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Armbrust <mich...@databricks.com>
Subject Re: cast only some columns
Date Tue, 21 Jun 2016 20:03:16 GMT
Use `withColumn`.  It will replace a column if you give it the same name.

On Tue, Jun 21, 2016 at 4:16 AM, pseudo oduesp <pseudo20140@gmail.com>
wrote:

> Hi ,
>  with fillna we can select  some columns to perform replace some values
>  with chosing columns with dict
> {columns :values }
> but how i can  do  same with cast i have data frame with 300 columns and i
> want just cats 4 from list columns  but with select query like that :
>
> df.select(columns1.cast(int),columns2.cast(int),columns3.cast(int))
>
> but i loose other columns
> how i can performe on some columns without loosing other ones ?
>
> thanks
>

Mime
View raw message