👩💻/pandas
1. 판다스 자료구조(1) - Series, 시리즈
글로랴
2021. 1. 18. 20:41
Series, 시리즈
시리즈는 데이터가 순차적으로 나열된 1차원 배열의 형태를 갖는다. 인덱스(index)와 데이터 값(values)를 가지며, 서로 일대일 대응된다. 이런 점에서 Python Dictionary와 비슷한 구조를 갖는다고 볼 수 있다.
데이터 주소 | 데이터 값 |
index 0 | data 0 |
index 1 | data 1 |
index 2 | data 2 |
: | : |
index n | data n |
▶ Series class 속성
- 📍 인덱스 : Series객체.index
- 📍 데이터 값 배열 : Series객체.values
▶ 원소 선택
import pandas as pd
tup = ('홍지', '2021-01-11', True)
profile = pd.Series(tup, index=['닉네임', '시작일', '게시물유무'])
# 1) 정수형 위치 인덱스(integer position)
print(profile[0]) # 0번째 자리에 있는 닉네임 : 홍지
# 2) 인덱스 이름/라벨(index name/label)
print(profile['닉네임']) # 인덱스 이름 '닉네임' : 홍지
반응형