본문 바로가기

부스트캠프 AI Tech

(58)
[05] 가변인자 def kwargs_test(one, two=3, *args, **kwargs): # * args 튜플형태로 # ** kwargs 사전형태로 # *(1,2,3,4,5) -> 1,2,3,4,5 unpacking 시에도 * 사용 print(one + two + sum(args)) print(two) print(args) print(kwargs) kwargs_test(10, 20, 1, 2, 3, 4, first = 3, second = 2) 40 20 (1, 2, 3, 4) {'first': 3, 'second': 2}
[04] Black으로 파이썬 코드 스타일 통일하기 https://www.daleseo.com/python-black/ Black으로 파이썬 코드 스타일 통일하기 Engineering Blog by Dale Seo www.daleseo.com
[03] 문자열 함수 정리 len(a) a.upper() a.lower() a.capitalize() a.title() a.count('abc') a.find('abc') a.startswith('abc') a.endswith('abc') a.strip() a.rstrip() a.lstrip() a.split() a.split('abc') a.isdigit() a.islower() a.isupper()
[02] if __name__=="__main__" if __name__=="__main__" __name__ 은 현재 모듈의 이름을 담고있는 내장 변수이다. 이 변수는 직접 실행된 모듈의 경우 __main__이라는 값을 가지게 되며, 직접 실행되지 않은 import된 모듈은 모듈의 이름(파일명)을 가지게 된다. #module.py def hello(): print("Hello!") print(__name__) #main.py import module print(__name__) module.hello() module __main__ Hello! import module 로 module을 직접 실행 안했기 때문에 moudule의 __name__ 내장변수에는 모듈 이름(파일명) module을 가지게 되므로 module 출력. 이때 모듈에 if __name_..
[01] f - string In [1]: name = "TaeHo" age = 27 In [2]: print(f"Hello, {name}. You are {age}.") print(f'{name:20}') print(f'{name:>20}') print(f'{name:*20}') print(f'{name:*^20}') number = 3.141592653589793 print(f'{number:.2f}') In [1]: In [2]: print(f"Hello, {name}. You are {age}.") print(f'{name:20}') print(f'{name:>20}') print(f'{name:*20}') print(f'{name:*^20}') number = 3.141592653589793 print(f'{number:...
[03] Line Plot Line Plot¶ In [1]: import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt In [2]: fig, axes = plt.subplots(1, 2, figsize=(12, 7)) x1 = [1, 2, 3, 4, 5] x2 = [1, 3, 2, 4, 5] y = [1, 3, 2, 1, 5] axes[0].plot(x1, y) axes[1].plot(x2, y) plt.show() In [3]: fig = plt.figure(figsize=(5, 5)) ax = fig.add_subplot(111, aspect=1) n = 1000 x = np.sin(np.linspace(0, 2*..
[02] Bar Plot Bar Plot¶ In [1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt barh 와 bar color 주기¶ # fig = plt.figure(12,7) # axes = fig.subplots(1,2) fig, axes = plt.subplots(1,2, figsize=(12,7)) x = list('ABCED') y = list(range(1,6)) clist = ['tomato', 'g', 'r', 'm', 'b'] axes[0].bar(x,y, color = clist) # 리스트로 개별 막대 색 주기 axes[1].barh(x..
[01] matplotlib In [1]: import numpy as np import matplotlib as mpl print(f'numpy version : {np.__version__}') # version check print(f'matplotlib version : {mpl.__version__}') # version check numpy version : 1.19.5 matplotlib version : 3.5.0 In [2]: import matplotlib.pyplot as plt In [3]: fig = plt.figure() plt.show() figure라는 큰 틀(figsize로 사이즈 조정). ax 는 서브플롯(그래프)라고 생각¶ In [14]: fig = plt.figure(figsize=(5,4)) a..
[00] Markdown
[04] 머신러닝 프로젝트 라이프 사이클 현상 파악 구체적인 문제 정의 프로젝트 설계 지표 결정 Action(모델 개발 후 배포, 모니터링) 추가 원인 분석 내가 관심있거나 가고싶은 회사 비즈니스 모델파악하기. // 누군가 산업에 정리해둔 paper 찾아보기