Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
df = pd.DataFrame({"X": ["p", 2, 3, 4]})
In [3]:
df = df.iloc[1:]
In [4]:
df
Out[4]:
X
1 2
2 3
3 4
In [5]:
df.dtypes
Out[5]:
X    object
dtype: object
In [6]:
df.infer_objects().dtypes
Out[6]:
X    int64
dtype: object