Drop specified labels from rows or columns.

Remove rows or columns by specifying label names and corresponding axis, or by specifying directly index or column names. When using a multi-index, labels on different levels can be removed by specifying the level.

param labels
single label or list-like

Index or column labels to drop.

param axis
{0 or ‘index’, 1 or ‘columns’}, default 0

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

param index
single label or list-like

Alternative to specifying axis (labels, axis=0 is equivalent to index=labels).

New in version 0.21.0.

param columns
single label or list-like

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

New in version 0.21.0.

param level
int or level name, optional

For MultiIndex, level from which the labels will be removed.

param inplace
bool, default False

If True, do operation inplace and return None.

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

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


DataFrame DataFrame without the removed index or column labels.


If any of the labels is not found in the selected axis.


  • Parameters labels, axis, index, level and inplace are currently unsupported.

  • Parameter columns is required and is expected to be a Literal value with one column name

    or Tuple with columns names.

  • Supported errors can be {raise, ignore}, default raise. If ignore, suppress error and only

    existing labels are dropped.


Drop specified columns from DataFrame.
import pandas as pd
from numba import njit

def dataframe_drop():
    df = pd.DataFrame({'A': [1.0, 2.0, 3.0, 1.0], 'B': [4, 5, 6, 7], 'C': ['a', 'b', 'c', 'd']})

    return df.drop(columns='A')

$ python ./dataframe/
   B  C
0  4  a
1  5  b
2  6  c
3  7  d

See also


Label-location based indexer for selection by label.


Return DataFrame with labels on given axis omitted where (all or any) data are missing.


Return DataFrame with duplicate rows removed, optionally only considering certain columns.


Return Series with specified index labels removed.