반응형
df = pd.DataFrame({'test': [ '1,000' ,'20000' ,'3000' ,'4,330' ]})
df['test'] = df.apply(lambda x: x['test'].replace(",", "").replace(" ", "") if x['test']
else '', axis=1)

for문에서 변경하기
for i, row in df.iterrows():
row.loc[i, 'age2'] = row['age'] + 10
반응형
'Python > Basic' 카테고리의 다른 글
| [Python] XlsxWriter - Excel 다루기 (0) | 2021.07.26 |
|---|---|
| [Python] sqlalchemy, json으로 변경 후 리턴 (3) | 2021.04.16 |
| [Python] 배열(리스트) 마지막 원소 찾기 (0) | 2020.12.16 |
| [Python] List - List 빼기 (1) | 2020.11.16 |
| [Python] psycopg2 설치 오류 (1) | 2020.11.11 |