pandas.api.extensions.ExtensionArray.copy#
- ExtensionArray.copy()[source]#
Return a copy of the array.
This method creates a copy of the ExtensionArray where modifying the data in the copy will not affect the original array. This is useful when you want to manipulate data without altering the original dataset.
- Returns:
- ExtensionArray
A new ExtensionArray object that is a copy of the current instance.
See also
DataFrame.copy
Return a copy of the DataFrame.
Series.copy
Return a copy of the Series.
Examples
>>> arr = pd.array([1, 2, 3]) >>> arr2 = arr.copy() >>> arr[0] = 2 >>> arr2 <IntegerArray> [1, 2, 3] Length: 3, dtype: Int64