BUG: retain extension dtypes in transpose by jbrockmendel · Pull Request #28048 · pandas-dev/pandas (original) (raw)
Pretty edge-cases, but can you check the output of
In [15]: df = pd.DataFrame({"A": pd.Categorical([1, 2]), "B": pd.Categorical([2, 1])})
In [16]: df.dtypes Out[16]: A category B category dtype: object
especially check the values? Those are considered the same dtype since the categories are unordered.