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
- GIT
- ASP
- 리눅스
- 유니티
- swift
- python
- mssql
- port
- PER
- MS-SQL
- ubuntu
- 라즈베리파이
- MySQL
- node.js
- sqlite
- Linux
- 다이어트
- Unity
- tensorflow
- urllib
- PyQt
- IOS
- Excel
- flutter
- PyQt5
- javascript
- pandas
- 함수
- 날짜
- 맛집
Archives
목록2024/07/01 (1)
아미(아름다운미소)
컬럼명을 닥셔너리에 저장 후 불러쓰기
1)import pandas as pd# 타입을 지정한 딕셔너리 생성col_dict = { 'first_col': 'str', 'second_col': 'int', 'third_col': 'float'}# 데이터프레임 생성df = pd.DataFrame({ 'first_col': ['a', 'b', 'c'], 'second_col': [1, 2, 3], 'third_col': [1.1, 2.2, 3.3]})# 컬럼 타입 지정for col, dtype in col_dict.items(): df[col] = df[col].astype(dtype)# 컬럼명 출력print(list(col_dict.keys())[2])2)import pandas as pd# 데이터프레임 생성..
랭귀지/pandas
2024. 7. 1. 14:53