用法:
CategoricalIndex.remove_categories(*args, **kwargs)
删除指定的类别。
removals
必须包含在旧类别中。已删除类别中的值将设置为 NaN- removals:类别或类别列表
应该删除的类别。
- inplace:布尔值,默认为 False
是否就地删除类别或返回已删除类别的此分类的副本。
- cat:分类或无
已删除类别的分类,如果
inplace=True
则为无。
- ValueError
如果删除不包含在类别中
参数:
返回:
抛出:
例子:
>>> c = pd.Categorical(['a', 'c', 'b', 'c', 'd']) >>> c ['a', 'c', 'b', 'c', 'd'] Categories (4, object):['a', 'b', 'c', 'd']
>>> c.remove_categories(['d', 'a']) [NaN, 'c', 'b', 'c', NaN] Categories (2, object):['b', 'c']
相关用法
- Python pandas.CategoricalIndex.remove_unused_categories用法及代码示例
- Python pandas.CategoricalIndex.rename_categories用法及代码示例
- Python pandas.CategoricalIndex.add_categories用法及代码示例
- Python pandas.CategoricalIndex.map用法及代码示例
- Python pandas.CategoricalIndex用法及代码示例
- Python pandas.Categorical用法及代码示例
- Python pandas.Categorical.from_codes用法及代码示例
- Python pandas.CategoricalDtype用法及代码示例
- Python pandas.arrays.IntervalArray.is_empty用法及代码示例
- Python pandas.DataFrame.ewm用法及代码示例
- Python pandas.api.types.is_timedelta64_ns_dtype用法及代码示例
- Python pandas.DataFrame.dot用法及代码示例
- Python pandas.DataFrame.apply用法及代码示例
- Python pandas.DataFrame.combine_first用法及代码示例
- Python pandas.read_pickle用法及代码示例
- Python pandas.Index.value_counts用法及代码示例
- Python pandas.DatetimeTZDtype用法及代码示例
- Python pandas.DataFrame.cumsum用法及代码示例
- Python pandas.Interval.is_empty用法及代码示例
- Python pandas.api.indexers.FixedForwardWindowIndexer用法及代码示例
注:本文由纯净天空筛选整理自pandas.pydata.org大神的英文原创作品 pandas.CategoricalIndex.remove_categories。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。