diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index d0dad26cfb275..e558e18d183e1 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -941,13 +941,11 @@ def fast_xs(self, loc: int) -> ArrayLike: n = len(self) if isinstance(dtype, ExtensionDtype): - # we'll eventually construct an ExtensionArray. - result = np.empty(n, dtype=object) - # TODO: let's just use dtype.empty? + cls = dtype.construct_array_type() + result = cls._empty((n,), dtype=dtype) else: result = np.empty(n, dtype=dtype) - - result = ensure_wrapped_if_datetimelike(result) + result = ensure_wrapped_if_datetimelike(result) for blk in self.blocks: # Such assignment may incorrectly coerce NaT to None @@ -955,9 +953,6 @@ def fast_xs(self, loc: int) -> ArrayLike: for i, rl in enumerate(blk.mgr_locs): result[rl] = blk.iget((i, loc)) - if isinstance(dtype, ExtensionDtype): - result = dtype.construct_array_type()._from_sequence(result, dtype=dtype) - return result def iget(self, i: int) -> SingleBlockManager: