本文簡要介紹
pyspark.pandas.MultiIndex.dropna
的用法。用法:
MultiIndex.dropna() → pyspark.pandas.indexes.base.Index
返回索引或MultiIndex,不帶 NA/NaN 值
例子:
>>> df = ps.DataFrame([[1, 2], [4, 5], [7, 8]], ... index=['cobra', 'viper', None], ... columns=['max_speed', 'shield']) >>> df max_speed shield cobra 1 2 viper 4 5 NaN 7 8
>>> df.index.dropna() Index(['cobra', 'viper'], dtype='object')
還支持MultiIndex
>>> midx = pd.MultiIndex([['lama', 'cow', 'falcon'], ... [None, 'weight', 'length']], ... [[0, 1, 1, 1, 1, 1, 2, 2, 2], ... [0, 1, 1, 0, 1, 2, 1, 1, 2]]) >>> s = ps.Series([45, 200, 1.2, 30, 250, 1.5, 320, 1, None], ... index=midx) >>> s lama NaN 45.0 cow weight 200.0 weight 1.2 NaN 30.0 weight 250.0 length 1.5 falcon weight 320.0 weight 1.0 length NaN dtype: float64
>>> s.index.dropna() MultiIndex([( 'cow', 'weight'), ( 'cow', 'weight'), ( 'cow', 'weight'), ( 'cow', 'length'), ('falcon', 'weight'), ('falcon', 'weight'), ('falcon', 'length')], )
相關用法
- Python pyspark MultiIndex.drop用法及代碼示例
- Python pyspark MultiIndex.droplevel用法及代碼示例
- Python pyspark MultiIndex.difference用法及代碼示例
- Python pyspark MultiIndex.delete用法及代碼示例
- Python pyspark MultiIndex.size用法及代碼示例
- Python pyspark MultiIndex.hasnans用法及代碼示例
- Python pyspark MultiIndex.to_numpy用法及代碼示例
- Python pyspark MultiIndex.levshape用法及代碼示例
- Python pyspark MultiIndex.max用法及代碼示例
- Python pyspark MultiIndex.min用法及代碼示例
- Python pyspark MultiIndex.unique用法及代碼示例
- Python pyspark MultiIndex.rename用法及代碼示例
- Python pyspark MultiIndex.value_counts用法及代碼示例
- Python pyspark MultiIndex.values用法及代碼示例
- 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用法及代碼示例
注:本文由純淨天空篩選整理自spark.apache.org大神的英文原創作品 pyspark.pandas.MultiIndex.dropna。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。