boolean
-
파이썬 boolean indexing 과 논리 연산자IT 2020. 12. 28. 23:54
라이브러리 호출 및 예제 작성 import pandas as pd # 데이터 처리용 라이브러리 import numpy as np # 수치해석용 라이브러리 sr=pd.Series([10,20,30,40,50], index=['a','b','c','d','e'], dtype=int,name='kor') boolean sr>=30 Result : a False b True c True d True e True Name: kor, dtype: bool sr[sr>=30] # boolean indexing : 30 이상인 열만 출력 Result : b 40 c 60 d 80 e 100 Name: kor, dtype: int64 논리 연산자 (and → & , or → | , not → ~) : pandas가 R의..