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
- mssql
- PyQt
- ubuntu
- sqlite
- tensorflow
- flutter
- GIT
- 맛집
- Excel
- 다이어트
- 라즈베리파이
- pandas
- ASP
- PER
- MySQL
- node.js
- Linux
- 날짜
- PyQt5
- swift
- 함수
- javascript
- 리눅스
- 유니티
- urllib
- IOS
- Unity
- MS-SQL
- python
- port
Archives
목록2025/07/09 (1)
아미(아름다운미소)
pandas concat
import pandas as pd# 예시: 둘 다 빈 DataFrame이지만 컬럼이 다름df1 = pd.DataFrame(columns=['a', 'b'])df2 = pd.DataFrame(columns=['b', 'c'])# 👉 모든 컬럼의 합집합 구하기all_columns = sorted(set(df1.columns).union(set(df2.columns)))# 👉 컬럼 맞춰주기 (reindex로 없으면 NaN 채움)df1 = df1.reindex(columns=all_columns)df2 = df2.reindex(columns=all_columns)# 👉 concatresult = pd.concat([df1, df2], ignore_index=True)print(result)
카테고리 없음
2025. 7. 9. 10:37