pandas¶ Panel Data: 금융데이터 계량 분석 Python Data Analysis Library https://pandas.pydata.org In [1]: import warnings warnings.filterwarnings('ignore') File Upload to Colab¶ Colab 가상환경에 파일 올리기 Colab 종료 시 파일은 삭제됨 Local_Disk to Colab_Linux_File_System PII.csv & PII.xlsx 업로드된 파일 확인 In [2]: !ls -l total 20 -rw-r--r-- 1 root root 723 Jul 6 05:02 PII.csv -rw-r--r-- 1 root root 9907 Jul 6 05:02 PII.xlsx drwxr..
Python
NumPy (Numerical Python)¶ 수학 및 과학적 연산을 쉽고 빠르게 지원 다차원 행렬(Array/Matrix)을 효과적으로 처리 일반적으로 같은 데이터 타입 값으로 구성 https://numpy.org In [ ]: import warnings warnings.filterwarnings('ignore') I. NumPy Package import ~ as In [ ]: import numpy as np Version Check In [ ]: np.__version__ Out[ ]: '1.22.4' II. Array 생성¶ Python List 구조를 사용 1) Scalar - 0D Array - Rank0 Tensor In [ ]: a0 = np.array(9) In [ ]: print(a..
Class and Package¶ In [1]: import warnings warnings.filterwarnings('ignore') I. Class¶ Class(Name Space): 개발자에 의해 지정된 독립된 메모리 공간(구조) 함수와 변수를 하나의 객체(Object)로 묶어서 관리 선언된 Class 사용을 위해 Instance 생성 필요 Class Method: Class 내에 선언된 함수 Class Member: Class 내에 선언된 변수 Instance Member: Class 내 함수에 선언된 변수 1) Class 선언¶ self: 첫 번째 매개변수 self는 Class로 생성한 Instance 자체를 지정 Class로 생성된 Object(객체) 자신을 참조하는 매개변수 self를 사용..
Function and Module¶ In [ ]: import warnings warnings.filterwarnings('ignore') I. def¶ 함수(Function): 지정된 입력값을 받아 처리 후 출력값 리턴 입력값 -> 함수(Function) -> 출력값 1) 사용자 정의 함수 with def addition( ) 정의 및 사용 In [ ]: def addition(m, n): k = m + n return k In [ ]: addition(m = 3, n = 6) Out[ ]: 9 2) 사용자 정의 함수 with lambda subtraction( ) 정의 및 사용 In [ ]: # def subtraction(m, n): # k = m - n # return k lambda: 한 줄로..
제어문(Control Statement)¶ if ~ else, for ~ in, while In [1]: import warnings warnings.filterwarnings('ignore') I. 조건문(if ~ else)¶ 1) if¶ 조건문 뒤에 콜론(:) 붙임 들여쓰기(Indentation) 주의 In [2]: score = 88 In [3]: if score == 88: print('획득한 점수는 %d점 입니다.' % score) 획득한 점수는 88점 입니다. 2) if ~ else¶ In [4]: if score == 100: print('100점 만점입니다.') else: print('아쉽지만 만점은 아니네요.') 아쉽지만 만점은 아니네요. 3) if ~ elif ~ else¶ 사용자 입력..
Python Data Structure¶ In [1]: import warnings warnings.filterwarnings('ignore') I. String¶ 문자열(String) 생성 In [2]: S1 = 'The truth is out there.' print(S1) The truth is out there. 1) Concatenation¶ '+': 문자열 연결 '*': 문자열 반복 In [3]: print('=' * 40) print('\t', S1) print('=' * 40) ======================================== The truth is out there. ======================================== In [4]: S2 = '..
Python Data Type and Operations¶ In [1]: import warnings warnings.filterwarnings('ignore') I. Python Function¶ 1) 함수 실행¶ print( ) 실행 In [2]: print('Hello World') Hello World 매개변수(Parameter) 및 인자/인수(Argument) 지정 In [3]: print('Hello World', end = '\t') Hello World In [4]: print('Hello', 'World', sep = '-') Hello-World 내장 매뉴얼 In [5]: help(print) Help on built-in function print in module builtins: ..