博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pandas.Series.drop
阅读量:7112 次
发布时间:2019-06-28

本文共 1260 字,大约阅读时间需要 4 分钟。

Series.
drop
(
labels=None
axis=0
index=None
columns=None
level=None
inplace=False
errors='raise'
)

Return new object with labels in requested axis removed.

去除指定轴向的数据。以下参数操作灵活,可以有不同路径完成同一目的

Parameters:

labels : single label or list-like

Index or column labels to drop.

axis : int or axis name

Whether to drop labels from the index (0 / ‘index’) or columns (1 / ‘columns’).

index, columns : single label or list-like

Alternative to specifying axis (labels, axis=1 is equivalent to columns=labels).

New in version 0.21.0.

level : int or level name, default None

For MultiIndex

inplace : bool, default False

If True, do operation inplace and return None.

errors : {‘ignore’, ‘raise’}, default ‘raise’

If ‘ignore’, suppress error and existing labels are dropped.

Returns:

dropped : type of caller

Notes

Specifying both labels and index or columns will raise a ValueError.

Examples

>>> df = pd.DataFrame(np.arange(12).reshape(3,4),                      columns=['A', 'B', 'C', 'D'])>>> df   A  B   C   D0  0  1   2   31  4  5   6   72  8  9  10  11

Drop columns

>>> df.drop(['B', 'C'], axis=1)   A   D0  0   31  4   72  8  11
>>> df.drop(columns=['B', 'C'])   A   D0  0   31  4   72  8  11

Drop a row by index

>>> df.drop([0, 1])   A  B   C   D2  8  9  10  11

转载地址:http://agmhl.baihongyu.com/

你可能感兴趣的文章
SQL SERVER 正则替换
查看>>
一个PHP小程序
查看>>
Echarts 动态获取数据进行图表的展示
查看>>
ansible命令基础
查看>>
【转】LINUX-APACHE服务的配置
查看>>
LVM的管理命令
查看>>
安装WSUS服务器
查看>>
线程安全与可重入函数的区别与联系
查看>>
vim使用记录
查看>>
php中 curl模拟post发送json并接收json
查看>>
简析J2EE应用程序数据库类设计模式
查看>>
十二周三次课 (3月14日)
查看>>
Hadoop子项目介绍
查看>>
【Interface&navigation】系统栏变暗(50)
查看>>
php判断用户输入验证码是否正确
查看>>
hbase hive整合
查看>>
搭建Linux操作系统+Oracle数据库的环境
查看>>
索引与排序
查看>>
第十二天 二维数组与多维数组
查看>>
什么是软件测试
查看>>