Rahul
Rahul

Reputation: 325

How to change the datatype of column in dask dataframe?

I have a column in my dask dataframe whose datatype is integer I want to change it to a float datatype, how can I do such an operation.

fid_price_df.head(3)

    fid selling_price
0   98101   439.00
1   67022   419.00
2   131142  299.00

In the above dask dataframe I need to change the 'fid' column into float datatype.

>>>type(fid_price_df)
dask.dataframe.core.DataFrame

Upvotes: 6

Views: 9098

Answers (1)

Kallol
Kallol

Reputation: 2189

try this:

fid_price_df['column_name_you_want_to_convert']=fid_price_df['column_name_you_want_to_convert'].astype(float)

so in this case,

fid_price_df['fid']=fid_price_df['fid'].astype(float)

Upvotes: 7

Related Questions