일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- pip
- Numpy
- Splunk
- Lotto
- mean
- Series
- SPL
- GT-S80
- mariadb
- pandas
- 알고리즘
- Button
- imread
- synology
- SciPy
- dataframe
- RNN
- 삼성소프트웨어멤버십
- pycharm
- CNN
- E-P1
- index
- DFS
- LSTM
- Python
- GitHub
- javascript
- keras
- ipad
- install
Archives
- Today
- Total
잠토의 잠망경
[Pandas] 데이터 추출(열, Column) 본문
한 열 단위 데이터 추출
Series : 1개 열
DataFrame : 2개 열 이상
열단위 Data 얻기
import pandas as pd
df = pd.read_csv('input.csv',sep=',')
column_df = df['country']
print(type(colum_df)) # Series
print(column_df.head()) # 5줄
print(column_df.tail()) # 하위 5줄
2열 이상 데이터 추출
columns_df = df[['country', 'continent', 'year']] # List 전달
print(type(columns_df)) # DataFrame
print(columns_df.head())
print(columns_df.tail())
Comments