本文简要介绍
pyspark.pandas.Index
的用法。用法:
class pyspark.pandas.Index
pandas-on-Spark 逻辑上对应pandas索引的索引。这可能会在内部保存 Spark Column。
- data:类似数组(一维)
- dtype:dtype,默认无
如果 dtype 为 None,我们会找到最适合数据的 dtype。如果提供了实际的 dtype,如果它是安全的,我们会强制使用该 dtype。否则,将引发错误。
- copy:bool
制作输入 ndarray 的副本。
- name:对象
要存储在索引中的名称。
- tupleize_cols:布尔(默认值:真)
当为 True 时,如果可能,尝试创建 MultiIndex。
参数:
例子:
>>> ps.DataFrame({'a': ['a', 'b', 'c']}, index=[1, 2, 3]).index Int64Index([1, 2, 3], dtype='int64')
>>> ps.DataFrame({'a': [1, 2, 3]}, index=list('abc')).index Index(['a', 'b', 'c'], dtype='object')
>>> ps.Index([1, 2, 3]) Int64Index([1, 2, 3], dtype='int64')
>>> ps.Index(list('abc')) Index(['a', 'b', 'c'], dtype='object')
从一个系列:
>>> s = ps.Series([1, 2, 3], index=[10, 20, 30]) >>> ps.Index(s) Int64Index([1, 2, 3], dtype='int64')
从索引:
>>> idx = ps.Index([1, 2, 3]) >>> ps.Index(idx) Int64Index([1, 2, 3], dtype='int64')
相关用法
- Python pyspark Index.is_monotonic_decreasing用法及代码示例
- Python pyspark Index.values用法及代码示例
- Python pyspark Index.drop_duplicates用法及代码示例
- Python pyspark IndexedRowMatrix.computeGramianMatrix用法及代码示例
- Python pyspark Index.value_counts用法及代码示例
- Python pyspark Index.map用法及代码示例
- Python pyspark Index.equals用法及代码示例
- Python pyspark Index.argmin用法及代码示例
- Python pyspark Index.argmax用法及代码示例
- Python pyspark Index.item用法及代码示例
- Python pyspark Index.insert用法及代码示例
- Python pyspark Index.nlevels用法及代码示例
- Python pyspark Index.min用法及代码示例
- Python pyspark Index.copy用法及代码示例
- Python pyspark Index.difference用法及代码示例
- Python pyspark Index.to_list用法及代码示例
- Python pyspark Index.shape用法及代码示例
- Python pyspark Index.dropna用法及代码示例
- Python pyspark Index.repeat用法及代码示例
- Python pyspark Index.notna用法及代码示例
- Python pyspark Index.has_duplicates用法及代码示例
- Python pyspark IndexedRowMatrix.numRows用法及代码示例
- Python pyspark Index.max用法及代码示例
- Python pyspark Index.astype用法及代码示例
- Python pyspark IndexedRowMatrix.toBlockMatrix用法及代码示例
注:本文由纯净天空筛选整理自spark.apache.org大神的英文原创作品 pyspark.pandas.Index。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。