on-internet
← Community

Compare dataframe columns: TypeError: Cannot interpret 'StringDtype' as a data type

Stack Overflow ·

I am trying to compare two dataframes' columns and types to check for equality; the rows are expected to be different. I am using pandas version 1.1.2 pd.__version__ '1.1.2' if (df1.columns.difference(df2.columns).empty) and (df1.dtypes == df2.dtypes).all() But this line errors: (df1.dtypes == df2.dtypes).all() Traceback (most recent call last): File "<string>", line 1, in <module> File "/Users/vfrank/dev-working/venv/lib/python3.7/site-packages/pandas/core/ops/common.py", line 65, in new_method return method(self, other) File "/Users/vfrank/dev-working/venv/lib/python3.7/site-packages/pandas/

Comments

Sign in or sign up to comment and upvote.

No comments yet.