本文简要介绍
pyspark.pandas.MultiIndex.astype
的用法。用法:
MultiIndex.astype(dtype: Union[str, type, numpy.dtype, pandas.core.dtypes.base.ExtensionDtype]) → IndexOpsLike
将 pandas-on-Spark 对象转换为指定的 dtype
dtype
。- dtype:数据类型
使用 numpy.dtype 或 Python 类型将整个 pandas 对象转换为相同类型。
- casted:与调用者相同的类型
参数:
返回:
例子:
>>> ser = ps.Series([1, 2], dtype='int32') >>> ser 0 1 1 2 dtype: int32
>>> ser.astype('int64') 0 1 1 2 dtype: int64
>>> ser.rename("a").to_frame().set_index("a").index.astype('int64') Int64Index([1, 2], dtype='int64', name='a')
相关用法
- Python pyspark MultiIndex.append用法及代码示例
- Python pyspark MultiIndex.size用法及代码示例
- Python pyspark MultiIndex.hasnans用法及代码示例
- Python pyspark MultiIndex.to_numpy用法及代码示例
- Python pyspark MultiIndex.levshape用法及代码示例
- Python pyspark MultiIndex.max用法及代码示例
- Python pyspark MultiIndex.drop用法及代码示例
- Python pyspark MultiIndex.min用法及代码示例
- Python pyspark MultiIndex.unique用法及代码示例
- Python pyspark MultiIndex.rename用法及代码示例
- Python pyspark MultiIndex.value_counts用法及代码示例
- Python pyspark MultiIndex.values用法及代码示例
- Python pyspark MultiIndex.difference用法及代码示例
- Python pyspark MultiIndex.sort_values用法及代码示例
- Python pyspark MultiIndex.spark.transform用法及代码示例
- Python pyspark MultiIndex.T用法及代码示例
- Python pyspark MultiIndex.ndim用法及代码示例
- Python pyspark MultiIndex.copy用法及代码示例
- Python pyspark MultiIndex.to_frame用法及代码示例
- Python pyspark MultiIndex.shape用法及代码示例
- Python pyspark MultiIndex.equals用法及代码示例
- Python pyspark MultiIndex.empty用法及代码示例
- Python pyspark MultiIndex.to_series用法及代码示例
- Python pyspark MultiIndex.symmetric_difference用法及代码示例
- Python pyspark MultiIndex.swaplevel用法及代码示例
注:本文由纯净天空筛选整理自spark.apache.org大神的英文原创作品 pyspark.pandas.MultiIndex.astype。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。