Skip to content

DOC: fix PR07,RT03,SA01 for pandas.MultiIndex.copy #59363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading