pandas.api.extensions.ExtensionArray.view#
- ExtensionArray.view(dtype=None)[source]#
Return a view on the array.
- Parameters:
- dtypestr, np.dtype, or ExtensionDtype, optional
Default None.
- Returns:
- ExtensionArray or np.ndarray
A view on the
ExtensionArray’s data.
See also
api.extensions.ExtensionArray.ravelReturn a flattened view on input array.
Index.viewEquivalent function for Index.
ndarray.viewNew view of array with the same data.
Examples
This gives view on the underlying data of an
ExtensionArrayand is not a copy. Modifications on either the view or the originalExtensionArraywill be reflected on the underlying data:>>> arr = pd.array([1, 2, 3]) >>> arr2 = arr.view() >>> arr[0] = 2 >>> arr2 <IntegerArray> [2, 2, 3] Length: 3, dtype: Int64