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
- Numpy
- 오류
- nvidia-smi
- error
- paramiko
- mysql
- Selenium
- SSH
- VS Code
- pandas
- Python
- C
- C#
- 핑거스타일
- Visual Studio
- C++
- ubuntu
- Docker
- pytorch
- pip
- 프로그래머스
- label
- OpenCV
- 컨테이너
- windows forms
- 기타 연주
- 채보
- JSON
- YOLO
- Linux
Archives
- Today
- Total
기계는 거짓말하지 않는다
Python DataFrame 특정 columns 추출 본문
DataFrame에서 특정 column만 추출
import numpy as np
import pandas as pd
dataFrame = pd.read_csv("data.csv", delimiter=",", encoding="euc-kr", skiprows=1) # 첫 행이 columns이면 skiprows 불필요
select_cols = ["col1", "col2", "col3", "col4"] # 특정 column의 field name
another_cols = ["col5", "col6"]
select_cols_frame = dataFrame[select_cols]
another_cols_frame = dataFrame[another_cols]
print(select_cols_frame)
# numpy 배열로
select_cols_numpy = select_cols_frame.to_numpy()'Python' 카테고리의 다른 글
| Python DataFrame 데이터 분리 후 csv 생성 (0) | 2021.10.08 |
|---|---|
| Python GUI PyQt5, QtDesigner (0) | 2021.10.07 |
| Python Ignoring invalid distribution 오류 (0) | 2021.09.26 |
| Python 예외 처리(Exception) (0) | 2021.09.05 |
| Python DataFrame 특정 값 추출 (0) | 2021.09.04 |
Comments