@@ -5256,7 +5256,7 @@ def _reindex_with_indexers(
5256
5256
self : NDFrameT ,
5257
5257
reindexers ,
5258
5258
fill_value = None ,
5259
- copy : bool_t = False ,
5259
+ copy : bool_t | None = False ,
5260
5260
allow_dups : bool_t = False ,
5261
5261
) -> NDFrameT :
5262
5262
"""allow_dups indicates an internal call here"""
@@ -5285,8 +5285,8 @@ def _reindex_with_indexers(
5285
5285
# If we've made a copy once, no need to make another one
5286
5286
copy = False
5287
5287
5288
- if copy and new_data is self ._mgr :
5289
- new_data = new_data .copy ()
5288
+ if ( copy or copy is None ) and new_data is self ._mgr :
5289
+ new_data = new_data .copy (deep = copy )
5290
5290
5291
5291
return self ._constructor (new_data ).__finalize__ (self )
5292
5292
@@ -9060,7 +9060,7 @@ def align(
9060
9060
join : AlignJoin = "outer" ,
9061
9061
axis : Axis | None = None ,
9062
9062
level : Level = None ,
9063
- copy : bool_t = True ,
9063
+ copy : bool_t | None = None ,
9064
9064
fill_value : Hashable = None ,
9065
9065
method : FillnaOptions | None = None ,
9066
9066
limit : int | None = None ,
@@ -9253,7 +9253,7 @@ def _align_frame(
9253
9253
join : AlignJoin = "outer" ,
9254
9254
axis : Axis | None = None ,
9255
9255
level = None ,
9256
- copy : bool_t = True ,
9256
+ copy : bool_t | None = None ,
9257
9257
fill_value = None ,
9258
9258
method = None ,
9259
9259
limit = None ,
@@ -9317,7 +9317,7 @@ def _align_series(
9317
9317
join : AlignJoin = "outer" ,
9318
9318
axis : Axis | None = None ,
9319
9319
level = None ,
9320
- copy : bool_t = True ,
9320
+ copy : bool_t | None = None ,
9321
9321
fill_value = None ,
9322
9322
method = None ,
9323
9323
limit = None ,
@@ -9346,7 +9346,7 @@ def _align_series(
9346
9346
if is_series :
9347
9347
left = self ._reindex_indexer (join_index , lidx , copy )
9348
9348
elif lidx is None or join_index is None :
9349
- left = self .copy () if copy else self
9349
+ left = self .copy (deep = copy ) if copy or copy is None else self
9350
9350
else :
9351
9351
left = self ._constructor (
9352
9352
self ._mgr .reindex_indexer (join_index , lidx , axis = 1 , copy = copy )
@@ -9375,7 +9375,7 @@ def _align_series(
9375
9375
left = self ._constructor (fdata )
9376
9376
9377
9377
if ridx is None :
9378
- right = other
9378
+ right = other . copy ( deep = copy ) if copy or copy is None else other
9379
9379
else :
9380
9380
right = other .reindex (join_index , level = level )
9381
9381
0 commit comments