Skip to content

Commit 3474043

Browse files
committed
DOC: Update warning in Index.values docstring to clarify index modification issues (pandas-dev#60954)
1 parent d538a1c commit 3474043

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/core/indexes/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -4912,6 +4912,10 @@ def values(self) -> ArrayLike:
49124912
:meth:`Index.to_numpy`, depending on whether you need
49134913
a reference to the underlying data or a NumPy array.
49144914
4915+
Modifying 'Index.values' directly is not supported and can lead to memory
4916+
corruption or segmentation faults. This is because 'Index.values' provides
4917+
a direct reference to internal NumPy data.
4918+
49154919
Returns
49164920
-------
49174921
array: numpy.ndarray or ExtensionArray

0 commit comments

Comments
 (0)