Data_Python

    [파이썬] Most Common Words 가장 자주 사용된 단어 추출

    [파이썬] Most Common Words 가장 자주 사용된 단어 추출

    [파이썬] Most Common Words 인자로 받은 txt 파일에서 가장 자주 나온 단어 순으로 출력하는 프로그램​ximport sysfrom collections import Counter try: num_words = int(sys.argv[1]) #두번째 인자except: print("usage: most_common_words.py nuim_words") sys.exit() counter = Counter(word.lower() for line in sys.stdin for word in line.strip().split() if word)for word, count in counter.most_common(num_words): sys.stdout.write(str(count)) sys.std..

    [Numpy] ddof 란? Degrees of Freedom 자유도 (np.var / np.std)

    [Numpy] ddof 란? Degrees of Freedom 자유도 (np.var / np.std)

    [Numpy] ddof 란? (np.var)numpy 에서 분산과 표준편차를 구할 때 아래와 같이 np.var()과 np.std() 를 사용한다.ximport numpy as npnp.var(x, ddof=1) #variance 분산np.std(x, ddof=1) #standard deviation 표준편차여기서 ddof 는 Degrees of Freedom 으로 자유도를 의미하고 설정해주는 것이다.Degrees of Freedom독립적인 정보의 개수통계값을 계산하기 위해 자유롭게 값을 가질 수 있는 숫자의 개수표본 개수 - 계산을 위해 사용하는 매개변수의 개수로 생각할 수 있다.n-1 개를 알고 있다면 마지막 1개의 값은 알 수 있다 => n-1 의 자유도ex) 10명의 학생의 시험 점수를 예로 들면,..

    [Matplotlib] pie 그래프와 예제 plt.pie()

    [Matplotlib] pie 그래프와 예제 plt.pie()

    Logout Menu Kernel File New NotebookDropdown Open... Make a Copy... Save as... Rename... Save and Checkpoint Revert to CheckpointDropdown Print Preview Download asDropdown AsciiDoc (.asciidoc) HTML (.html) LaTeX (.tex) Markdown (.md) Notebook (.ipynb) PDF via LaTeX (.pdf) reST (.rst) Script () Reveal.js slides (.slides.html) PDF via HTML (.pdf) Deploy as Trust Notebook Close and Halt Edit Cut Ce..

    [Matplotlib] Scatter 그래프와 예제 plt.scatter

    [Matplotlib] Scatter 그래프와 예제 plt.scatter

    Logout Menu Kernel File New NotebookDropdown Open... Make a Copy... Save as... Rename... Save and Checkpoint Revert to CheckpointDropdown Print Preview Download asDropdown AsciiDoc (.asciidoc) HTML (.html) LaTeX (.tex) Markdown (.md) Notebook (.ipynb) PDF via LaTeX (.pdf) reST (.rst) Script () Reveal.js slides (.slides.html) PDF via HTML (.pdf) Deploy as Trust Notebook Close and Halt Edit Cut Ce..

    [Matplotlib] Bar 그래프와 예제 plt.bar()

    [Matplotlib] Bar 그래프와 예제 plt.bar()

    matplotlib¶ matplotlib.pyplot 라이브러리 import In [1]: import matplotlib.pyplot as plt Bar¶ show how some quantity varies In [10]: plt.bar([1,3,0,10], [10,23,30,1]) plt.show() width¶ default = 0.8 (기본 0.8로 설정되어 있음) In [11]: plt.bar([1,2,3,4,5],[10,20,30,40,50], width=0.1) plt.show() Bar의 위치 변경¶ In [12]: def make_chart_simple_bar_chart(): movies = ["Annie Hall", "Ben-hur", "Casablanca", "Gandhi"] num..

    [Matplotlib] Plot (line) 그래프 / plt.plot(), plt.axis(), plt.title(), plt.xlabel(), plt.ylabel(), plt.legend(), plt.xticks(), plt.yticks()

    [Matplotlib] Plot (line) 그래프 / plt.plot(), plt.axis(), plt.title(), plt.xlabel(), plt.ylabel(), plt.legend(), plt.xticks(), plt.yticks()

    matplotlib¶ matplotlib.pyplot 라이브러리 import In [1]: import matplotlib.pyplot as plt plot¶plt.plot()¶ 기본 그래프 그리기 In [2]: plt.plot([1,2,10], [10,20,5])#x,y 값 (1,10) (2,20) (10, 5) plt.show() In [3]: plt.plot(['a', 'b', 'c'], [10, 29 ,5]) plt.show Out[3]: axis()¶ 축의 범위 지정 In [4]: plt.axis([-0.5, 2.2, 0, 21]) #[xmin, xmax, ymin, ymax] plt.plot(['z', 'b', 'a..