DataFrame.dropna(axis=0,
how='any',
subset=['columns_label'],
inplace=False
)
axis=
0 행을 삭제 / 1 열을 삭제how=
'any' 1개만 Nan이여도 삭제 / 'all' 전부 Nan이면 삭제subset=
입력받은 list 내 칼럼명만 조사inplace=
True면 원본 수정 / False면 원본 수정 안함.(새 변수에 초기화 필요)DataFrame.dropna(*, axis=0,
how='any',
thresh=0,
subset=['columns_label'],
inplace=False, # True or True
ignore_index=False # True or True)
Series.dropna(*,
axis=0,
inplace=False,
how=None, # 공식 문서에 정의는 되어있으나 사용하지 않음.
ignore_index=False)
Index.dropna(how='any')
DataFrame/Series/index 객체 내 missing values를 제거하여 반환해줌.
axis = 0
or 'index'
: Nan값이 있는 행을 삭제axis = 1
or column
: Nan값이 있는 열을 삭제how = 'any'
: Nan값이 1개라도 있을 경우 제거how = 'all'
: 모든 값이 Nan일 경우 제거thresh = n
: 제거하려는 행(or 열) 내 Nan값이 n개 미만일 경우 제거how
파라미터와 함께 사용 불가df.dropna(axis=0, subset=['delete_column1', 'delete_column2']
inplace = True
일 경우 원본 객체를 수정함.inplace = False
일 경우 원본 객체를 수정하지 않음.ignore_index = True
: Nan값 삭제 후 index를 0부터 새롭게 설정ignore_index = False
: Nan값 삭제 후 index 유지