Data, What?/Python

[Book] Python for Data Analysis(3E) -1-

GrilleDream 2022. 6. 7. 01:52

 

https://wesmckinney.com/book/

https://wesmckinney.com/book/preliminaries.html

 

Python for Data Analysis, 3E - 1  Preliminaries

This Open Access web version of Python for Data Analysis 3rd Edition is now available in Early Release and will undergo technical editing and copy-editing before going to print later in 2022. If you encounter any errata, please report them here. If you fin

wesmckinney.com

 

어떤 데이터를 대상으로?

    -Tabular 혹은 스프레드 시트 형태의 column 형식 데이터

    -multi-dimensional array(매트릭스)

    -Key Columns로 연결된 여러 테이블

    -Time-series

    -etc.


왜 Python을 써야 하나?

    -(상대적으로)쉽다!

    -다른 프로그래밍 언어를 연결해주는 "Glue" 성격을 가진 언어다(C, C++, FORTRAN etc)

    -매우 낮은 지연시간 or 리소스 효율 극대화 등의 문제를 제외하면 매우 널리 사용된다


주요 Python Libraries

NumPy

    -Numerical Python의 준말

    -데이터 저장, 계산에 매우 효과적임

    -각종 알고리즘과 data structure를 지원함

pandas

    -Panel data(계량경제 등에서 주로 사용)의 준말이었으나, 현재는 python data analysis 그 자체로 통용됨

    -high-level data structure 지원

    -각종 알고리즘과 data structure를 지원함

    -Labeling 관련 편의성

    -Indexing, Time-series, Metadata 등 다양한 기능 지원

matplotlib

    -plot, 2차원 시각화 소스 라이브러리

    -이외에도 여럿 존재하지만 default로 사용하기 좋음

IPython & Jupyter

    -Python을 더욱 interactive 하도록 만들어 줌

    -Edit -> Compile -> Run workflow 에서 Execute -> Explore workflow로 전환

    -데이터 분석 코딩의 대다수가 Exploration, Trial and Error, Iteration이 있는 만큼 효과적

    -IPython web notebook이 Jupyter notebook이 되었고 현재는 여러 언어를 지원

    -Markdown, HTML 등을 포함할 수 있어 Rich-Document 제공 가능

SciPy

    -Scientific computing에서 발생하는 근본적인 문제들에 대한 패키징

    -integrate, linalg, optimize, signal, sparse, special, stats 등 다양한 모듈 존재함

    -NumPy와 SciPy 만으로도 웬만한 기초 베이스를 모두 지원함

scikit-learn

    -가장 대중적인 ML 툴-킷

    -다양한 서브모듈 지원

  • 분류(SVM, Random Forest, Logistic Reg 등)
  • 회귀(Lasso, Ridge 등)
  • 클러스터링(k-means, spectral clustering 등)
  • 차원축소(PCA, feature selection, matrix factorization 등)
  • 모델 선택(Grid search, cross-validation 등)
  • 전처리(feature extraction, normalization 등)

statsmodels

    -scikit-learn과 비교했을 때 전통적인 통계학, 계량경제학 알고리즘을 다룸

    -Linear Reg, Generalized linear, Robust linear, ANOVA, ARIMA, kernal reg, 시각화 등

    -statistical Inference, uncertainty estimates을 제공하고 파라미터의 p-value 등에 더 집중함


설치법

-교재에서는 miniconda installer를 활용한 방법 소개(이미 설치되어 있어서 패스)

-가능하면 conda 명령어를 pip 보다 우선할 것

    --개별적인 pip 업데이트 or 설치는 환경 문제를 일으킬 수 있음

-Shell 환경에서 활용해도 상관없지만 취향에 따라 IDE, Text Editor 활용해도 괜찮음

    --Pydev, PyCharm, VS, Spyder etc.