How to change the datatype of column in dask dataframe?

Rah*_*hul 6 python types pandas dask

我的 dask 数据框中有一列数据类型为整数,我想将其更改为浮点数据类型,我该如何进行这样的操作。

fid_price_df.head(3)

    fid selling_price
0   98101   439.00
1   67022   419.00
2   131142  299.00
Run Code Online (Sandbox Code Playgroud)

在上面的 dask 数据框中,我需要将“fid”列更改为浮点数据类型。

>>>type(fid_price_df)
dask.dataframe.core.DataFrame
Run Code Online (Sandbox Code Playgroud)

Kal*_*lol 7

尝试这个:

fid_price_df['column_name_you_want_to_convert']=fid_price_df['column_name_you_want_to_convert'].astype(float)
Run Code Online (Sandbox Code Playgroud)

所以在这种情况下,

fid_price_df['fid']=fid_price_df['fid'].astype(float)
Run Code Online (Sandbox Code Playgroud)