메서드와 패키지

MATLAB 사용자를 위한 Python

Justin Kiggins

Product Manager

메서드는 변수에 연결된 함수입니다

  • 변수 타입에 따라 다름
  • 점으로 접근
yelling = "WHY ARE YOU YELLING?"
whispering = yelling.lower()
print(whispering)
why are you yelling?
MATLAB 사용자를 위한 Python

.format() 메서드

n_avocados = 1765
message = "I have {} avocados!".format(n_avocados)

print(message)
I have 1765 avocados!
MATLAB 사용자를 위한 Python

Python 패키지

NumPy 로고

matplotlib 로고

pandas 로고

MATLAB 사용자를 위한 Python
import math

math.pi
3.141592653589793
math.log(0.9)
-0.10536051565782628

패키지의 일부만 가져오기:

from math import log
log(0.9)
-0.10536051565782628
MATLAB 사용자를 위한 Python

패키지 별칭

import datetime as dt

birth_date = dt.datetime(1961,8,4)
# Import NumPy package with common alias import numpy as np x = np.ndarray([1, 2, 3])
# Import pandas package with common alias import pandas as pd df = pd.DataFrame()
# Import Matplotlib pyplot module with common alias import matplotlib.pyplot as plt plt.show()
# Import Seaborn package with common alias import seaborn as sns sns.set_theme()
MATLAB 사용자를 위한 Python

유용한 메서드와 패키지를 살펴봅시다

MATLAB 사용자를 위한 Python

Preparing Video For Download...