As long as the column names match and you have the same number of columns, you can simply compare dtypesdirectly:
In [152]:
df1 = pd.DataFrame({'int':np.arange(5), 'flt':np.random.randn(5)})
df2 = pd.DataFrame({'int':np.random.randn(5), 'flt':np.random.randn(5)})
df1.dtypes == df2.dtypes
Out[152]:
flt True
int False
dtype: bool
source
share