Infer Objects

import numpy as np
import pandas as pd
df = pd.DataFrame({'a': [7, 1, 5], 'b': ['3','2','1']}, dtype='object')
df
a b
0 7 3
1 1 2
2 5 1
df.dtypes
a    object
b    object
dtype: object
df = df.infer_objects()
df.dtypes
a     int64
b    object
dtype: object
# You can see that dataype of column a is changed to int64.