강의

멘토링

커뮤니티

Inflearn Community Q&A

9a24dc46f70d51624832's profile image
9a24dc46f70d51624832

asked

Python Data Visualization Analysis Practical Project

Data cleaning

컬럼삭제

Written on

·

254

0

컬럼삭제시 axis=1과 axis='columns' 중 아무거나 써도 상관 없는건가요? 

아니면 저 두가지를 구분해서 써야 하는 경우가 따로 있을까요?

pythonpandas

Answer 2

1

nomad님의 프로필 이미지
nomad
Instructor

안녕하세요?

결론 부터 말씀드리면 axis=1과 axis='columns' 중 아무거나 써도 상관없습니다.

관련 아래 스펙에 보면,

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html

관련 아래 스펙에 보면, 명시적으로 쓰인 컬럼에서 drop 내역을 지정해 줄 경우 1또는 'columns'를 사용하라 했습니다. 인덱스를 사용할 경우는 0을 쓰고요. 저는 교육목적 상 보시기 좋게 'columns'을 썼습니다.

도움 되시길 바랍니다.

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

kj님의 프로필 이미지
kj
Questioner

항상 감사합니다!

9a24dc46f70d51624832's profile image
9a24dc46f70d51624832

asked

Ask a question