Skip to content
Advertisement

Dask Df convert All Dtype using dictionary

JavaScript

Is there an easy equivalent way to convert all columns in a dask df(converted from a pandas df) using a dictionary. I have a dictionary as follows:

JavaScript

and would like to convert the pandas|dask df dtypes all at once to the suggested dtypes in the dictionary.

JavaScript

Advertisement

Answer

Not sure if I understand the question correctly, but the conversion of dtypes can be done using .astype (as you wrote), except you would want to remove .dtype from the assignment:

JavaScript
Advertisement