Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.Series.view#

Series.view(dtype=None)[source]#

Create a new view of the Series.

Deprecated since version 2.2.0:Series.view is deprecated and will be removed in a future version.UseSeries.astype() as an alternative to change the dtype.

This function will return a new Series with a view of the sameunderlying values in memory, optionally reinterpreted with a new datatype. The new data type must preserve the same size in bytes as to notcause index misalignment.

Parameters:
dtypedata type

Data type object or one of their string representations.

Returns:
Series

A new Series object as a view of the same data in memory.

See also

numpy.ndarray.view

Equivalent numpy function to create a new view of the same data in memory.

Notes

Series are instantiated withdtype=float64 by default. Whilenumpy.ndarray.view() will return a view with the same data type asthe original array,Series.view() (without specified dtype)will try usingfloat64 and may fail if the original data type sizein bytes is not the same.

Examples

Useastype to change the dtype instead.


[8]ページ先頭

©2009-2025 Movatter.jp