I have this dataFrame
df = pd.DataFrame({"A":["1","2","aj"],"B":["1.5555","899999999999999999999999","dfhasdi"]})
which gives output
A B
0 1 1.5555
1 2 899999999999999999999999
2 aj dfhasdi
The data Type for each cell is
A B
0 <class 'str'> <class 'str'>
1 <class 'str'> <class 'str'>
2 <class 'str'> <class 'str'>
The required data type for each cell is
A B
0 <class 'int'> <class 'float'>
1 <class 'int'> <class 'int'>
2 <class 'str'> <class 'str'>
I did this so far
df = df.apply(pd.to_numeric, errors='ignore')
Which doesn't change the data type.