Skip to content

Commit

Permalink
DOC: fix PR07,RT03,SA01 for pandas.MultiIndex.copy (#59363)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhinsharma121 authored Jul 31, 2024
1 parent 73b5578 commit 70c7aca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
--format=actions \
-i ES01 `# For now it is ok if docstrings are missing the extended summary` \
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
-i "pandas.MultiIndex.copy PR07,RT03,SA01" \
-i "pandas.MultiIndex.get_level_values SA01" \
-i "pandas.MultiIndex.get_loc PR07" \
-i "pandas.MultiIndex.get_loc_level PR07" \
Expand Down
21 changes: 19 additions & 2 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,20 +1282,37 @@ def copy( # type: ignore[override]
name=None,
) -> Self:
"""
Make a copy of this object.
Make a copy of this object. Names, dtype, levels and codes can be passed and \
will be set on new copy.
Names, dtype, levels and codes can be passed and will be set on new copy.
The `copy` method provides a mechanism to create a duplicate of an
existing MultiIndex object. This is particularly useful in scenarios where
modifications are required on an index, but the original MultiIndex should
remain unchanged. By specifying the `deep` parameter, users can control
whether the copy should be a deep or shallow copy, providing flexibility
depending on the size and complexity of the MultiIndex.
Parameters
----------
names : sequence, optional
Names to set on the new MultiIndex object.
deep : bool, default False
If False, the new object will be a shallow copy. If True, a deep copy
will be attempted. Deep copying can be potentially expensive for large
MultiIndex objects.
name : Label
Kept for compatibility with 1-dimensional Index. Should not be used.
Returns
-------
MultiIndex
A new MultiIndex object with the specified modifications.
See Also
--------
MultiIndex.from_arrays : Convert arrays to MultiIndex.
MultiIndex.from_tuples : Convert list of tuples to MultiIndex.
MultiIndex.from_frame : Convert DataFrame to MultiIndex.
Notes
-----
Expand Down

0 comments on commit 70c7aca

Please sign in to comment.