pyspark.pandas.Index.astype

索引。 astype ( dtype:联盟(str,类型,numpy.dtype,pandas.core.dtypes.base.ExtensionDtype] )→IndexOpsLike

把指定dtype pandas-on-Spark对象dtype

参数
dtype 数据类型

使用numpy。dtypeor Python type to cast entire pandas object to the same type.

返回
在同一 相同类型作为调用者

另请参阅

to_datetime

将参数转换为日期时间。

例子

> > >爵士=ps系列([1,2),dtype=“int32”)> > >爵士0 11 2dtype: int32
> > >爵士astype(“int64”)0 11 2dtype: int64
> > >爵士重命名(“一个”)to_frame()set_index(“一个”)指数astype(“int64”)Int64Index ([1,2], dtype = int64, name = ' a ')