Skip to content

Commit e2b0f49

Browse files
REF: Use copy helper for GH#63306 logic in Index constructor
1 parent fd6de1d commit e2b0f49

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pandas/core/indexes/base.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,8 @@ def __new__(
505505
if not copy and isinstance(data, (ABCSeries, Index)):
506506
refs = data._references
507507

508-
if isinstance(data, (ExtensionArray, np.ndarray)):
509-
# GH 63306
510-
if copy is not False:
511-
if dtype is None or astype_is_view(data.dtype, dtype):
512-
data = data.copy()
513-
copy = False
508+
# GH 63306, GH 63388
509+
data, copy = cls._maybe_copy_array_input(data, copy, dtype)
514510

515511
# range
516512
if isinstance(data, (range, RangeIndex)):

0 commit comments

Comments
 (0)