Skip to content

Commit 9f0c098

Browse files
committed
use is_homogeneous_type
1 parent 45fd5f6 commit 9f0c098

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ def transpose(self, *args, **kwargs):
727727
nv.validate_transpose(tuple(), kwargs)
728728
result = self._constructor(new_values, **new_axes).__finalize__(self)
729729

730-
if len(self.columns) and (self.dtypes == self.dtypes.iloc[0]).all():
730+
if self.ndim == 2 and self._is_homogeneous_type:
731731
# FIXME: self.dtypes[0] can fail in tests
732732
if is_extension_array_dtype(self.dtypes.iloc[0]):
733733
# Retain ExtensionArray dtypes through transpose;

0 commit comments

Comments
 (0)