用法:
Index.delete(loc)
删除传递的位置(-s)创建新索引。
- loc:int 或 int 列表
将被删除的项目(-s)的位置。使用位置列表同时删除多个值。
- index
将与 self 类型相同,但 RangeIndex 除外。
参数:
返回:
例子:
>>> idx = pd.Index(['a', 'b', 'c']) >>> idx.delete(1) Index(['a', 'c'], dtype='object')
>>> idx = pd.Index(['a', 'b', 'c']) >>> idx.delete([0, 2]) Index(['b'], dtype='object')
相关用法
- Python pandas.Index.duplicated用法及代码示例
- Python pandas.Index.drop_duplicates用法及代码示例
- Python pandas.Index.droplevel用法及代码示例
- Python pandas.Index.difference用法及代码示例
- Python pandas.Index.value_counts用法及代码示例
- Python pandas.Index.argmin用法及代码示例
- Python pandas.Index.is_categorical用法及代码示例
- Python pandas.Index.to_series用法及代码示例
- Python pandas.Index.str用法及代码示例
- Python pandas.Index.to_numpy用法及代码示例
- Python pandas.Index.is_object用法及代码示例
- Python pandas.Index.slice_indexer用法及代码示例
- Python pandas.Index.is_interval用法及代码示例
- Python pandas.Index.notnull用法及代码示例
- Python pandas.Index.equals用法及代码示例
- Python pandas.Index.set_names用法及代码示例
- Python pandas.Index.searchsorted用法及代码示例
- Python pandas.Index.is_monotonic_increasing用法及代码示例
- Python pandas.Index.min用法及代码示例
- Python pandas.Index.is_monotonic_decreasing用法及代码示例
注:本文由纯净天空筛选整理自pandas.pydata.org大神的英文原创作品 pandas.Index.delete。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。