Skip to content

Commit 94ac82b

Browse files
DOC: fix PR07,RT03,SA01 for pandas.MultiIndex.copy
1 parent 73b5578 commit 94ac82b

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7070
--format=actions \
7171
-i ES01 `# For now it is ok if docstrings are missing the extended summary` \
7272
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
73-
-i "pandas.MultiIndex.copy PR07,RT03,SA01" \
7473
-i "pandas.MultiIndex.get_level_values SA01" \
7574
-i "pandas.MultiIndex.get_loc PR07" \
7675
-i "pandas.MultiIndex.get_loc_level PR07" \

pandas/core/indexes/multi.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,20 +1282,37 @@ def copy( # type: ignore[override]
12821282
name=None,
12831283
) -> Self:
12841284
"""
1285-
Make a copy of this object.
1285+
Make a copy of this object. Names, dtype, levels and codes can be passed and \
1286+
will be set on new copy.
12861287
1287-
Names, dtype, levels and codes can be passed and will be set on new copy.
1288+
The `copy` method provides a mechanism to create a duplicate of an
1289+
existing MultiIndex object. This is particularly useful in scenarios where
1290+
modifications are required on an index, but the original MultiIndex should
1291+
remain unchanged. By specifying the `deep` parameter, users can control
1292+
whether the copy should be a deep or shallow copy, providing flexibility
1293+
depending on the size and complexity of the MultiIndex.
12881294
12891295
Parameters
12901296
----------
12911297
names : sequence, optional
1298+
Names to set on the new MultiIndex object.
12921299
deep : bool, default False
1300+
If False, the new object will be a shallow copy. If True, a deep copy
1301+
will be attempted. Deep copying can be potentially expensive for large
1302+
MultiIndex objects.
12931303
name : Label
12941304
Kept for compatibility with 1-dimensional Index. Should not be used.
12951305
12961306
Returns
12971307
-------
12981308
MultiIndex
1309+
A new MultiIndex object with the specified modifications.
1310+
1311+
See Also
1312+
--------
1313+
MultiIndex.from_arrays : Convert arrays to MultiIndex.
1314+
MultiIndex.from_tuples : Convert list of tuples to MultiIndex.
1315+
MultiIndex.from_frame : Convert DataFrame to MultiIndex.
12991316
13001317
Notes
13011318
-----

0 commit comments

Comments
 (0)