- NewYork Times 읽기
- TOC
- 티스토리 자동 목차
- tistory 목차
- magic command
- jupyter notebook shell commands
- tistory toc
- fig ax 사용
- matplotlib 객제 지향 방식
- 티스토리 목차
목록DataScience/Python (11)
develop myself
help 인터넷이 안 되는 상황에서 문서를 확인할 수 있다. import numpy as np import pandas as pd # class help(np.ndarray) # function help(np.array) help(pd.DataFrame) dir python object(class, method 등등)를 확인할 수 있다. dir(pd.DataFrame) 특정 조건을 만족하는 object를 찾을 경우 [ obj for obj in dir(pd.DataFrame) if ("na" in obj) & (not obj.startswith("_"))]
magic commands IPython의 기능. 즉, interactive 환경에서 사용한다. 주로 jupyter notebook에서 사용. python 구문을 확장한 기능. %로 시작하여 사용 line magics: %로 시작하여 사용. 한 문장을 실행. cell magics: %%로 시작하여 사용. 한 셀을 실행 주요 magic commands %matplotlib inline # delete all variables in namespace %reset %run myscript.py %timeit L = [n ** 2 for n in range(1000)] %%timeit L = [] for n in range(1000): L.append(n ** 2) help 특정 magic command의 문서..
.format() method 기본적인 방법 In [1]: 'We are the {} who say "{}!"'.format('knights', 'Ni') Out[1]: 'We are the knights who say "Ni!"' 순서 명시 In [2]: '{0} and {1}'.format('spam', 'eggs') Out[2]: 'spam and eggs' In [3]: '{1} and {0}'.format('spam', 'eggs') Out[3]: 'eggs and spam' 변수명 명시 In [4]: 'This {food} is {adjective}.'.format( food='spam', adjective='absolutely horrible') Out[4]: 'This spam is abs..