本文簡要介紹
pyspark.pandas.Series.cat.remove_categories
的用法。用法:
cat.remove_categories(removals: Union[pandas.core.indexes.base.Index, Any, List], inplace: bool = False) → Optional[ps.Series]
刪除指定的類別。
removals
必須包含在舊類別中。已刪除類別中的值將設置為NaN- removals:類別或類別列表
應該刪除的類別。
- inplace:布爾值,默認為 False
是否就地刪除類別或返回已刪除類別的此分類的副本。
自版本 3.2.0 起已棄用。
- 係列或無
已刪除類別的分類,如果
inplace=True
則為無。
- ValueError
如果刪除不包含在類別中
參數:
返回:
拋出:
例子:
>>> s = ps.Series(list("abbccc"), dtype="category") >>> s 0 a 1 b 2 b 3 c 4 c 5 c dtype: category Categories (3, object): ['a', 'b', 'c']
>>> s.cat.remove_categories('b') 0 a 1 NaN 2 NaN 3 c 4 c 5 c dtype: category Categories (2, object): ['a', 'c']
相關用法
- Python pyspark Series.cat.remove_unused_categories用法及代碼示例
- Python pyspark Series.cat.rename_categories用法及代碼示例
- Python pyspark Series.cat.reorder_categories用法及代碼示例
- Python pyspark Series.cat.ordered用法及代碼示例
- Python pyspark Series.cat.as_unordered用法及代碼示例
- Python pyspark Series.cat.set_categories用法及代碼示例
- Python pyspark Series.cat.as_ordered用法及代碼示例
- Python pyspark Series.cat.add_categories用法及代碼示例
- Python pyspark Series.cat.categories用法及代碼示例
- Python pyspark Series.cat.codes用法及代碼示例
- Python pyspark Series.cumsum用法及代碼示例
- Python pyspark Series.cummax用法及代碼示例
- Python pyspark Series.copy用法及代碼示例
- Python pyspark Series.cummin用法及代碼示例
- Python pyspark Series.cumprod用法及代碼示例
- Python pyspark Series.count用法及代碼示例
- Python pyspark Series.combine_first用法及代碼示例
- Python pyspark Series.clip用法及代碼示例
- Python pyspark Series.corr用法及代碼示例
- Python pyspark Series.compare用法及代碼示例
- Python pyspark Series.asof用法及代碼示例
- Python pyspark Series.to_frame用法及代碼示例
- Python pyspark Series.rsub用法及代碼示例
- Python pyspark Series.mod用法及代碼示例
- Python pyspark Series.str.join用法及代碼示例
注:本文由純淨天空篩選整理自spark.apache.org大神的英文原創作品 pyspark.pandas.Series.cat.remove_categories。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。