MATLAB 사용자를 위한 Python
Justin Kiggins
Product Manager
print(radius)
[[1, 2, 3]]
type(radius)
<class 'numpy.ndarray'>
area = np.pi * (radius ** 2)
print(area)
[3.14159265 12.56637061
28.27433388]
| 연산 | 연산자 |
|---|---|
| 덧셈 | + |
| 뺄셈 | - |
| 곱셈 | * |
| 나눗셈 | / |
| 거듭제곱 | ** |
type(revenue)
<class 'numpy.ndarray'>
print(revenue)
[[100, 114, 96, 120]]
type(cost)
<class 'numpy.ndarray'>
print(cost)
[102. 104. 101. 102.]
profit = revenue - cost
print(profit)
[-2. 10. -5. 18.]
import numpy as np
np.mean(revenue)
107.5
유용한 NumPy 함수:
np.min() 배열에서 최솟값 반환np.max() 배열에서 최댓값 반환np.sum() 배열의 모든 값의 합 반환MATLAB 사용자를 위한 Python