Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- Linux
- MySQL
- Unity
- 맛집
- 유니티
- ubuntu
- python
- 다이어트
- port
- swift
- flutter
- 날짜
- 라즈베리파이
- IOS
- urllib
- sqlite
- tensorflow
- node.js
- mssql
- pandas
- ASP
- PyQt
- javascript
- PER
- GIT
- 함수
- MS-SQL
- PyQt5
- Excel
- 리눅스
Archives
목록2024/07/16 (2)
아미(아름다운미소)
pandas 여러열적용
df[cols] = df[cols].astype(float).fillna(0).astype(int)cols = ['A', 'B', 'C', 'D'] # 변환하고 싶은 열 이름들for col in cols: df[col] = pd.to_numeric(df[col], errors='coerce').fillna(0).astype(int) df[cols] = df[cols].apply(pd.to_numeric, errors='coerce').fillna(0).astype(int)예제import pandas as pd# 샘플 데이터프레임 생성data = { 'A': ['1', '2', '3', '4', ''], 'B': ['5', '6', '7', '8', 'abc'], 'C': ['..
랭귀지/pandas
2024. 7. 16. 19:57