hipdf.Index.astype#
21 min read time
Applies to Linux
- Index.astype(dtype, copy: bool = True)#
Create an Index with values cast to dtypes.
The class of a new Index is determined by dtype. When conversion is impossible, a ValueError exception is raised.
Parameters#
- dtype
numpy.dtype
Use a
numpy.dtype
to cast entire Index object to.- copybool, default False
By default, astype always returns a newly allocated object. If copy is set to False and internal requirements on dtype are satisfied, the original data is used to create a new Index or the original Index is returned.
Returns#
- Index
Index with values cast to specified dtype.
Examples#
>>> import cudf >>> index = cudf.Index([1, 2, 3]) >>> index Int64Index([1, 2, 3], dtype='int64') >>> index.astype('float64') Float64Index([1.0, 2.0, 3.0], dtype='float64')
- dtype