[Numpy] 배열 만들기 (np.arange/np.random)
2021. 5. 26. 15:14
1. import
import numpy as np
2. 등간격 배열 생성
array = np.arange(start_num, end_num, step, dtype)
3. 랜덤 배열 생성
random.randint()
- [start, end) 범위의 임의의 정수를 반환
array = np.random.randint(start, end, size=(row,column))
random.rand()
- [0, 1) 범위의 난수를 반환
array = np.random.rand(row, column)
random.randn()
- 표준정규분포로부터 샘플링된 난수를 반환
array = np.random.randn(row, column)
random.normal()
- 정규분포 N(μ,σ2) 로부터 샘플링된 난수를 반환
array = np.random.normal(loc, scale, size=(row,column))
내가 공부하려고 작성하는 포스트
'Data Analysis | Engineering > Python' 카테고리의 다른 글
[Numpy] 행렬 재배열(Reshape), 이어붙이기(Concatenate), 나누기(Split) (0) | 2021.07.03 |
---|---|
[Numpy] 배열의 정보(자료형, 차원, 모양, 크기, 요소) 확인하기 (0) | 2021.06.04 |