eland.DataFrame.drop

DataFrame.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:

Index or column labels to drop.

axis:

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

index, columns:

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

level:

For MultiIndex - not supported

inplace:

If True, do operation inplace and return None.

errors:

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

Returns
dropped:

type of caller

Examples

Drop a column

>>> df = ed.DataFrame('http://localhost:9200', 'ecommerce', columns=['customer_first_name', 'email', 'user'])
>>> df.drop(columns=['user'])
     customer_first_name                       email
0                  Eddie  eddie@underwood-family.zzz
1                   Mary      mary@bailey-family.zzz
2                   Gwen      gwen@butler-family.zzz
3                  Diane   diane@chandler-family.zzz
4                  Eddie      eddie@weber-family.zzz
...                  ...                         ...
4670                Mary     mary@lambert-family.zzz
4671                 Jim      jim@gilbert-family.zzz
4672               Yahya     yahya@rivera-family.zzz
4673                Mary     mary@hampton-family.zzz
4674             Jackson  jackson@hopkins-family.zzz
<BLANKLINE>
[4675 rows x 2 columns]

Drop rows by index value (axis=0)

>>> df.drop(['1', '2'])
     customer_first_name                       email     user
0                  Eddie  eddie@underwood-family.zzz    eddie
3                  Diane   diane@chandler-family.zzz    diane
4                  Eddie      eddie@weber-family.zzz    eddie
5                  Diane    diane@goodwin-family.zzz    diane
6                 Oliver      oliver@rios-family.zzz   oliver
...                  ...                         ...      ...
4670                Mary     mary@lambert-family.zzz     mary
4671                 Jim      jim@gilbert-family.zzz      jim
4672               Yahya     yahya@rivera-family.zzz    yahya
4673                Mary     mary@hampton-family.zzz     mary
4674             Jackson  jackson@hopkins-family.zzz  jackson
<BLANKLINE>
[4673 rows x 3 columns]