diff --git a/pandas/core/internals/concat.py b/pandas/core/internals/concat.py index 0592db8ad608d..d1a252f727e90 100644 --- a/pandas/core/internals/concat.py +++ b/pandas/core/internals/concat.py @@ -1,6 +1,6 @@ from __future__ import annotations -import copy +import copy as cp import itertools from typing import ( TYPE_CHECKING, @@ -691,7 +691,7 @@ def _trim_join_unit(join_unit: JoinUnit, length: int) -> JoinUnit: else: extra_block = join_unit.block - extra_indexers = copy.copy(join_unit.indexers) + extra_indexers = cp.copy(join_unit.indexers) extra_indexers[0] = extra_indexers[0][length:] join_unit.indexers[0] = join_unit.indexers[0][:length] diff --git a/pandas/core/reshape/merge.py b/pandas/core/reshape/merge.py index cc9a7b7f8d40b..9e73dcb789075 100644 --- a/pandas/core/reshape/merge.py +++ b/pandas/core/reshape/merge.py @@ -3,7 +3,7 @@ """ from __future__ import annotations -import copy +import copy as cp import datetime from functools import partial import string @@ -1637,7 +1637,7 @@ def get_join_indexers( lkey, rkey, count = _factorize_keys(lkey, rkey, sort=sort, how=how) # preserve left frame order if how == 'left' and sort == False - kwargs = copy.copy(kwargs) + kwargs = cp.copy(kwargs) if how in ("left", "right"): kwargs["sort"] = sort join_func = {