I have a data frame in which all the data in columns are of type object. Now I want to convert all objects into numeric types using astype() function but I don't want to do something like this ->
df.astype({'col1': 'int32' , 'col2' : 'int32' ....})
If I do something like this ->
I get an error because apply function needs Series to traverse.
PS: The other option of doing the same thing is ->
df.apply(pd.to_numeric)
But I want to do this using .astype() Is there any other way instead of using df.apply() and still convert all object type data into numeric using df.astype()