본문 바로가기
  • 紹睿: 자유롭고 더불어 사는 가치있는 삶

Data67

[데이터 분석] python을 활용한 데이터 분석 (1) - 패키지 소개 Python을 활용한 데이터 분석(1) - 패키지 소개 - 데이터분석용 주요 패키지1) numpy: 수치, 통계, 선형대수2) mayplotlib3) scipy4) pandas: array를 이용한 다차원의 data structure .. 1. Numpy수치 데이터 처리 기능을 확장arrayasarrayarangeones, ones_likezeros, zeros_like, empty, empty_likeeye, identity universal functions- 일종의 vectorized wrapper1) abs, fabs2) sqrt3) square4) exp : 자연 지수5) log, log10, log2, log1p6) sign7) ceil8) floor9) rint10) modf... 등등 2... 2018. 7. 8.
[python] 알아두면 좋은 Standard Library Standard Library https://docs.python.org/3/library 1. 내장 함수 및 내장 상수 2. 내장 타입(Built-in Types) - 데이터 타입 - Exception 3. Text Processing Services - string - ** re - Regular expression - 기타(difflib, unicodedata ...) 4. Numeric 및 mathematical modules - math, cmath, random ... 5. Data Persistence/파일관련 - ** pickel(Python object serialization) - marshal - ** sqlite3 - 파일 포맷 관련: zlib, gzip 등 파일 압축 관련, csv.. 2018. 6. 29.
[python 기초] Exception 처리 Exception exceptional condition: error상황을 맏으면 raise exception 프로그램이 exception을 적절하게 처리하지 못하면 error message(=traceback)와 함께 프로그램을 종료시킨다. - raise(): 의도적으로 exception을 발생시킴 raise Exception # raise Exception # Exception - exception Hierarchy: https://docs.python.org/3/library/exceptions.html#exception-hierarchy - Custom Exception: 개발자가 직접! 예외상황이 되었을때, "이떻게 처리해라!!"라고 지정해 줄수 있다.(후속처리) Exception을 이용하면 방.. 2018. 6. 29.
[python 기초] OOP - class와 Object Object Oriented Programming python에서 class는 data type으로 본다. 1. Class와 Object class - a user-defined prototype for an object - 틀(class) -> 제품 (instance/object) class 특징 1) Encapsulation 불필요한 detail을 감추는 것 2) Polymorphism( =! Compile이 아니라, runtime에 자동적으로 obejct의 type에 따라 자동으로 작업내용이 달라지는 것 3) Inheritance: Class - subclass, Parent-child 2. Class와 Type 1) Class 만들기 - constructor - initializer 2) Attr.. 2018. 6. 29.
[python 기초] python의 file mode 파일 열기 1. File mode 값 설명 'r' 읽기 'w' 쓰기 'a' append 'b' binary(다른 mode에 추가) '+' Read/write(다른 mode에 추가 Binary 모드에서는 MS windows에서의 \n\r을 변환시키는 문제 등을 해결한다. 2. 파일관련 methods - 파일 읽기 및 쓰기 f = open('py_test.txt', 'w') f.write('hello') f.close() f = open('py_test.txt', 'r') print(f.readline()) # Open source software is made better when users can easily contribute code and documentation to fix bugs and add.. 2018. 6. 29.
[python 기초] python의 함수에 대하여 Python 함수: Functional Language 특징을 가지고 있음 추상화의 한 단계 1. 함수의 작성 def method1() def square(x): return x*x print(square(5)) # 25 Parameter: abc(x, y) 정의 시: Formal parameter 호출 시: Actual parameter 1. Loop 변수의 문제 local scope(자신이 지정된 function 또는 block)만 을 이용하는 변수 함수 내에서는 기본적으로 별도의 copy본을 만들어 사용 (두 x는 다른 아이들임) def inc(x): return x+1 x = 20 print(inc(x)) # 21 print(x) # 20 2. return 값을 굳이 주지 않아도 됨 def cha.. 2018. 6. 28.