Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,23 +941,18 @@ 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
# result[blk.mgr_locs] = blk._slice((slice(None), loc))
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:
Expand Down