Data Analysis / pandas / DataFrame(3)
1. loc[ ]를 이용한 추출 import numpy as np import pandas as pd data = {'이름':['이순신', '홍길동', '강감찬', '김유신', '장보고'], '학과':['컴퓨터', '기계', '철학', '컴퓨터', '국어국문'], '학년':[1,2,2,4,3], '학점':[1.5, 2.0, 3.1, 1.1, 2.7]} df = pd.DataFrame(data, columns=['학과','이름','학점','학년','등급'], index=['one','two','three','four','five']) # 행 추출 display(df.loc['one':'three']) # 행과 열을 동시에 추출할 수도 있다. # display(df.loc[..