넘파이,NumPy

넘파이,NumPy (rev. 1.3)

from https://wikidocs.net/22849
{
np.array
a = [1,2,3,4,5]   # list a를 만들어서
b = np.array(a)   # array 자료형으로 바꾸자
# 여기서 type(b) 하면 numpy.ndarray 라고 나온다. nd는 다차원(n-dimensional)을 뜻함.
np.sqrt, multiply(내적), max, min, argmax, argmin(최대값 최소값의 index)
np.random.randint(9)는 0부터 9까지 숫자중 아무 숫자나 하나 생성
np.random.randint(숫자1, 숫자2, size = 난수갯수)
}

ndarray

a가 있을 때
a.shape : 크기 (x, y)를 돌려줌.
a.reshape(x, y) : 크기 x, y로 바꿈.

np.zeros(n) : 0.으로만 이뤄진 배열을 만듦
np.ones(n) : 1.로만
다차원 배열일때는
np.zeros((행 갯수, 열 갯수)) 처럼 괄호를 두번 써야 함

원소의 index를 찾으려면 (list처럼 .index()가 아님)
np.where('찾으려는 원소' == array이름)

np.sum(a) : 합
np.arange(n) : 수열을 만듦. array형으로.

기타

MathInspector
https://mathinspector.com/
A Visual Programming Environment for Scientific Computing
Free open source software designed for students, content creators, and professional mathematicians