기타 파일 유형 소개

Python에서 데이터 가져오기 입문

Hugo Bowne-Anderson

Data Scientist at DataCamp

기타 파일 유형

  • Excel 스프레드시트
  • MATLAB 파일
  • SAS 파일
  • Stata 파일
  • HDF5 파일
Python에서 데이터 가져오기 입문

Pickle 파일

  • Python 고유 파일 유형
  • 동기: 저장 방식이 명확하지 않은 자료형이 많음
  • Pickle 파일은 직렬화됨
  • 직렬화 = 객체를 바이트스트림으로 변환
Python에서 데이터 가져오기 입문

Pickle 파일

import pickle
with open('pickled_fruit.pkl', 'rb') as file:
    data = pickle.load(file)    
print(data)
{'peaches': 13, 'apples': 4, 'oranges': 11}
Python에서 데이터 가져오기 입문

Excel 스프레드시트 가져오기

import pandas as pd
file = 'urbanpop.xlsx'
data = pd.ExcelFile(file)
print(data.sheet_names)
['1960-1966', '1967-1974', '1975-2011']
df1 = data.parse('1960-1966') # 시트 이름(문자열)
df2 = data.parse(0) # 시트 인덱스(실수)
Python에서 데이터 가져오기 입문

학습 내용:

  • 가져오기 사용자 지정 방법
  • 행 건너뛰기
  • 특정 열만 가져오기
  • 열 이름 변경
Python에서 데이터 가져오기 입문

연습해 봅시다!

Python에서 데이터 가져오기 입문

Preparing Video For Download...