1 분 소요

Jupyter Notebook

주피터 노트북은 웹 브라우저 상에서 개발을 할 수 있는 도구이며, 코드를 Cell 단위로 묶어서 실행하고 그래프나 표, 그리고 이미지나 영상 등을 쉽게 볼 수 있어서 특히 데이터 관련 작업을 할 때 많이 활용 됩니다.

교육을 위한 강의 노트로도 아주 훌륭해요!

image.png

anaconda.png

특징

  1. 코드를 Cell 단위로 작성 및 실행

  2. 마크다운을 통한 문서화

  3. 그래프나 표 등을 실시간으로 확인

  4. html. pdf 등 파일로 저장

사전 학습 자료

다음 링크에서 파이썬 기본편에 대한 학습을 하실 수 있습니다.

나도코딩 블로그

%%HTML
<iframe width="640" height="360" src="https://www.youtube.com/embed/PjhlUzp_cU0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

파이썬 기본 문법

print("Hello World")
Hello World
print("환영합니다")
환영합니다
name = "연탄이"
print(name)
연탄이
print("Ctrl + Enter : 현재 Cell 실행")
Ctrl + Enter : 현재 Cell 실행
print("Shift + Enter : 현재 Cell 실행 후 다음 Cell 선택")
Shift + Enter : 현재 Cell 실행 후 다음 Cell 선택
print("Alt + Enter : 현재 Cell 실행 후 다음 위치에 Cell 삽입")
Alt + Enter : 현재 Cell 실행 후 다음 위치에 Cell 삽입

시각화 예제 1 : 그래프

  • matplotlib를 이요하면 다양한 그래프를 그릴 수 있으며 수행 결과를 바로 확인할 수 있습니다.
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots()  # Create a figure containing a single axes.
ax.plot([1, 2, 3, 4], [1, 4, 2, 3]);  # Plot some data on the axes.

시각화 예제 2:테이블

  • pandas는 복잡한 데이터를 분석할 때 아주 유용합니다.
import pandas as pd
import numpy as np

df = pd.DataFrame([[38.0, 2.0, 18.0, 22.0, 21, np.nan],[19, 439, 6, 452, 226,232]],
                  index=pd.Index(['Tumour (Positive)', 'Non-Tumour (Negative)'], name='Actual Label:'),
                  columns=pd.MultiIndex.from_product([['Decision Tree', 'Regression', 'Random'],['Tumour', 'Non-Tumour']], names=['Model:', 'Predicted:']))
df.style
Model: Decision Tree Regression Random
Predicted: Tumour Non-Tumour Tumour Non-Tumour Tumour Non-Tumour
Actual Label:            
Tumour (Positive) 38.000000 2.000000 18.000000 22.000000 21 nan
Non-Tumour (Negative) 19.000000 439.000000 6.000000 452.000000 226 232.000000

댓글남기기