여기는 기본적인 파이썬 함수들을 정리합니다.
1. 객체의 삭제 : del 객체명
2. 다중 조건문을 사용해서 변수를 사용하는 방법
A. numpy.select를 사용하는 방법
col = 'consumption_energy'
conditions = [ df2[col] >= 400, (df2[col] < 400) & (df2[col]> 200), df2[col] <= 200 ]
choices = [ "high", 'medium', 'low' ]
df2["energy_class"] = np.select(conditions, choices, default=np.nan)
B. numpy.where를 중첩해서 사용하는 방법
C. 사용자 함수를 만들어서 넣는 방법
반응형
'Python, PySpark' 카테고리의 다른 글
Python 주요 라이브러리 (0) | 2021.05.13 |
---|---|
Python에서 하둡으로 자료 보내기 (0) | 2021.05.13 |
날짜 테이블에 있는 값을 dicitionary()에 저장 (0) | 2021.05.07 |
Python - 날짜 관련 함수들 (0) | 2021.05.07 |
Jupyter Notebook 명령어 및 옵션들 (0) | 2021.05.06 |