2020.08 To Do List
DataFrame
DataFrame.drop
(labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise')
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.
Parameters
labels: single label or list-like
Index or column labels to drop.
axis {0 or ‘index’, 1 or ‘columns’}, default 0
Whether to drop labels from the index (0 or ‘index’) or columns (1 or ‘columns’). (0은 Row, 행을 의미하고, 1은 Columns 컬럼을 의미한다.)
index: single label or list-like
Alternative to specifying axis (labels, axis=0
is equivalent to index=labels
).
columns: single label or list-like
Alternative to specifying axis (labels, axis=1
is equivalent to columns=labels
).
level: int or level name, optional
For MultiIndex, level from which the labels will be removed.
inplace: bool, default False
If False, return a copy. Otherwise, do operation inplace and return None.
(만약 False라면 삭제 후, 새로운 DataFrame를 생성한다. True일 경우, 기존의 DataFrame에 삭제된 DataFrame을 덮어쓴다. 그래서 아무것도 리턴하지 않는다.)
errors {‘ignore’, ‘raise’}, default ‘raise’
If ‘ignore’, suppress error and only existing labels are dropped.
Returns: DataFrame or None
DataFrame without the removed index or column labels or None if inplace=True
.
Raises: KeyError
If any of the labels is not found in the selected axis.