python 및 머신러닝 교육, 슬로우캠퍼스

gzip 파일을 읽기/쓰기 위해서는 기본 패키지에 있는 gzip을 이용하면 된다.


아래는 utf-8로 구성되어 있는 파일이 gzip 으로 압축된 경우에  읽고,
처리 결과를 다시 utf-8 형식으로 출력하고 gzip 으로 압축하여 파일을 쓰는  예시이다.


import sys
import codecs
import gzip

# read/write gzip file
reader=codecs.getreader("utf-8")
writer=codecs.getwriter("utf-8")

# two input files given, one output file given
A=reader(gzip.open(sys.argv[1], 'rb'))
B=reader(gzip.open(sys.argv[2], 'rb'))
C=writer(gzip.open(sys.argv[3], 'wb'))



gzip 압축이 아닌, 일반 text 파일이 utf-8 로 encoding된 경우의 읽기, 쓰기 방법은 아래와 같다.

#A=codecs.open(sys.argv[1], 'rb', encoding='utf-8')
#B=codecs.open(sys.argv[2], 'rb', encoding='utf-8')
#C=codecs.open(sys.argv[3], 'wb', encoding='utf-8')



WRITTEN BY
manager@
Data Analysis, Text/Knowledge Mining, Python, Cloud Computing, Platform

,

python 및 머신러닝 교육, 슬로우캠퍼스



사이트 http://scipy.org/ ,  http://scipy.github.com

  수학/과학/공학 및 데이타 분석을 위한 모든 python 패키지/라이브러리 포털의 역할을 제공하고자 한다. numpy가 가장 기본 패키지이다.  scipy, pandas, pytables 들은 numpy 기반으로 구현되었다.



NumPy
Base N-dimensional array package
SciPy library
Fundamental library for scientific computing
Matplotlib
Comprehensive 2D Plotting
IPython
Enhanced Interactive Console
Sympy
Symbolic mathematics
pandas
Data structures & analysis



pandas  데이터 분석에 알맞은 패키지.  

    • 금융분야에서 일하는 Wes McKinney 라는 사람이 2008년에 만든 데이타 분석용 (Time Series 등) 패키지. 계속 발전 중.
    • pandas 홈피: http://pandas.pydata.org/
    • Wes McKinney
      • 블로그: http://blog.wesmckinney.com/
      • 발표 자료 : http://www.slideshare.net/wesm/intro-to-python-for-financial-data-analysis
      • twitter.com/wesmckinn 

  

Python for Data Analysis

  책: "Python for Data Analysis" : pandas를 만든 분('Wes McKinney')이 쓴 책으로, pandas 의 사용법 및 분석 개발이 잘 설명되어 있다. 


 http://oreilly.com/shop/product/0636920023784.html










scikit

python 에서 machine learning , data mining 을 할때 필수적으로 사용되는 오픈소스로서, 거의 대부분의 machine learning 알고리즘이 있을 뿐만 아니라, 그것을 아주 편하게 사용할 수 있게 시스템화 되어 있다.


scrapy

  • scrapy : python 에서 크롤링 할때 사용하는 대표적인 오픈소스로서, 크롤링을 우아하고 쉽게 할 수 있게 도와준다.


SciTools : 과학/공학 계산에 알맞은 패키지.  numpy, scpy 기반.  

홈피: https://code.google.com/p/scitools/

is a Python package containing many useful tools for scientific computing in Python. The package is built on top of other widely used packages such as NumPy, SciPy, ScientificPython, Matplotlib, Gnuplot, etc.






  PyTables

커뮤니티 활동이 활발해 보이지는 않음.

'Data/Text/Knowledge Analysis & Mining' 카테고리의 다른 글

Crawler 운영 관리 도구  (0) 2013.07.11
DBPedia ontology  (0) 2013.07.11
DBpedia 데이타  (0) 2013.07.11
추천 관련 좋은 강의자료  (0) 2013.04.15
Web mining, Visualization  (0) 2013.03.13

WRITTEN BY
manager@
Data Analysis, Text/Knowledge Mining, Python, Cloud Computing, Platform

,