Skip to content

Commit a7b4e27

Browse files
committed
Fix
1 parent f7724ff commit a7b4e27

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/internals/managers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,15 @@ def convert(self: T, copy: bool | None) -> T:
445445
elif copy is None:
446446
copy = True
447447

448+
if self.is_single_block:
449+
original_blocks = [self.blocks[0]]
450+
else:
451+
original_blocks = [self.blocks[i] for i in self.blknos]
448452
mgr = self.apply(
449453
"convert",
450454
copy=copy,
451455
using_copy_on_write=using_copy_on_write(),
452-
original_blocks=[self.blocks[i] for i in self.blknos],
456+
original_blocks=original_blocks,
453457
)
454458
refs = [getattr(blk, "_ref", None) is not None for blk in mgr.blocks]
455459
if any(ref is not None for ref in refs):

0 commit comments

Comments
 (0)