Pandas 데이터프레임 .iloc

1 개요[ | ]

Pandas iloc
Pandas .iloc
pandas.DataFrame.iloc
  • "Purely integer-location based indexing for selection by position"
  • 위치 기반 선택
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/jmnote/zdata/master/R/iris.csv")
df.drop(df.loc[:144].index, inplace=True)
df
# 1행
df.iloc[0]
# 1행 × 1컬럼
df.iloc[0, 0]
# 1행 × 2컬럼
df.iloc[0, :2]
# 2행
df.iloc[:2]
# 2행 × 1컬럼
df.iloc[:2, 0]
# 2행 × 2컬럼
df.iloc[:2, :2]
# N행
df.iloc[:]
# N행 × 1컬럼
df.iloc[:, 0]
# N행 × 2컬럼
df.iloc[:, :2]

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}