From 9f0c098a28ec1bed61537d50f4abfaa2c9f86441 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Mon, 26 Aug 2019 14:25:10 -0700 Subject: [PATCH] use is_homogeneous_type --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index cccf8215de196..1818b9cfdb5a2 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -727,7 +727,7 @@ def transpose(self, *args, **kwargs): nv.validate_transpose(tuple(), kwargs) result = self._constructor(new_values, **new_axes).__finalize__(self) - if len(self.columns) and (self.dtypes == self.dtypes.iloc[0]).all(): + if self.ndim == 2 and self._is_homogeneous_type: # FIXME: self.dtypes[0] can fail in tests if is_extension_array_dtype(self.dtypes.iloc[0]): # Retain ExtensionArray dtypes through transpose;