Open
Description
Ref: https://github.com/pandas-dev/pandas/pull/43213/files#r699680952
Example:
df = pd.DataFrame({'a': [1], 'b': [2]})
print(df.T.dtypes)
df['b'] = df['b'].astype('Int64')
print(df.T.dtypes)
gives int64 for the first example, and object for the 2nd. However, the 2nd arguably would be better off as Int64.
The code from #43213 could be used in the transpose method, something akin to
from pandas.core.dtypes.cast import find_common_type
df = pd.DataFrame({'a': [1], 'b': [2]})
df['b'] = df['b'].astype('Int64')
common_type = find_common_type(df.dtypes.tolist())
print(df.T.astype(common_type, copy=False).dtypes)
Perhaps there are undesirable side-effects by doing this?