pandas.Series.drop
pandas 3.1.1 · Series and accessors · method
Remove rows or columns by label. Specify columns= to make column removal explicit.
Call syntax
Series.drop(labels=None, *, axis=0, index=None, columns=None, level=None, inplace=…, errors='raise')Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
labels |
Optional Positional or keyword Default None |
single label or list-like Provide the labels used for selecting rows, renaming entries, or naming bins. |
axis |
Optional Keyword only Default 0 |
{0 or 'index'} Choose which axis the operation acts on. The accepted axis labels depend on the receiver. |
index |
Optional Keyword only Default None |
single label or list-like Supply row labels or control how existing row labels are used. |
columns |
Optional Keyword only Default None |
single label or list-like Supply column labels or control how columns are handled. |
level |
Optional Keyword only Default None |
int or level name Choose an index level by name or integer position. |
inplace |
Optional Keyword only |
bool Choose whether to change the existing object. Where supported, an in-place call typically returns None. |
errors |
Optional Keyword only Default 'raise' |
{'ignore', 'raise'} Choose how to handle invalid input or failed operations. The available options depend on the API. |
Returns
Series or None