How can I see which dtypes
in a pandas data frame are not equal?
I.e. to find out why df1.dtypes.equals(df2.dtypes)
returns False
So long as the column names match and you have the same number of columns then you can just compare the dtypes
directly:
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