pandas1 .loc와 .iloc의 차이점/왜 둘은 모두 []를 사용할까?/loc와iloc가 데이터를 가져오는 과정 1. .loc와 .iloc의 차이점구분.loc[].iloc[]약자.loc = location .iloc = integer location 기반라벨(Label) 기반정수(Integer) 기반 행 선택df.loc['a'] → 'a' 인덱스의 행df.iloc[0] → 첫 번째(0번째) 행열 선택df.loc[:, 'A'] → 'A' 열 선택df.iloc[:, 0] → 첫 번째(0번째) 열 선택범위 선택df.loc['a':'c'] → 'a'~'c' 포함df.iloc[0:2] → 0~1 (마지막 포함 X) 2. ()이 아니라 []를 사용하는 이유.loc는 함수(메서드)가 아니라 호출할 수 없는 속성(attribute)이기 때문 "호출할 수 없는 속성(attribute) 객체란?"👉 Python에서 "호출할 수 .. 2025. 3. 3. 이전 1 다음