Alter the Datatype of Multiple Columns at Once
A common approach to alter the datatype of multiple columns is to invoke the 𝐚𝐬𝐭𝐲𝐩𝐞() method individually for each column.
Although the approach works as expected, it requires multiple function calls and more code. This can be particularly challenging when you want to modify the datatype of many columns.
As a better approach, you can condense all the conversions into a single function call. This is achieved by passing a dictionary of column-to-datatype mapping, as shown below.
Further reading: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.astype.html