일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- pandas
- keras
- LSTM
- 알고리즘
- CNN
- pip
- index
- 삼성소프트웨어멤버십
- Button
- E-P1
- dataframe
- SciPy
- GitHub
- RNN
- GT-S80
- mean
- javascript
- install
- SPL
- synology
- imread
- ipad
- Python
- Series
- DFS
- Numpy
- mariadb
- Splunk
- pycharm
- Lotto
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