https://wooono.tistory.com/293
[Python] Pandas DataFrame 컬럼 값 조건 변경
DataFrame 생성 import pandas as pd data = {'name':['michael','louis','jack','jasmine'], 'grades':[90,80,70,60], 'result':['N/A','N/A','N/A','N/A']} df = pd.DataFrame(data,columns=['name','grades','result']) # name grades result #0 michael 90 N/A #1 louis
wooono.tistory.com
np.where로 쓰는 방법도 있다.
'파이썬. 데이터분석 > Pandas' 카테고리의 다른 글
SettingWithCopyWarning 알람 원인, 끄기 (0) | 2024.09.28 |
---|---|
numeric, categorical 나누는 순환문 코드 (0) | 2024.09.21 |
type과 dtype 차이 (0) | 2024.07.30 |
파이썬 reshape (0) | 2024.07.29 |
Pandas df.read_excel, read_csv .to_csv .to_excel 읽기 내보내기 (0) | 2024.05.30 |