일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- SQL
- Mac
- gas
- hive
- google apps script
- Google Spreadsheet
- PANDAS
- PostgreSQL
- 파이썬
- Excel
- Java
- matplotlib
- Github
- c#
- Tkinter
- dataframe
- django
- Apache
- math
- Python
- PySpark
- Redshift
- array
- GIT
- numpy
- Google Excel
- list
- Kotlin
- string
- Today
- Total
목록rand (2)
달나라 노트
import numpy as np arr_1 = np.random.rand(5) print(arr_1) arr_2 = np.random.rand(5) print(arr_2) -- Result [0.64589411 0.43758721 0.891773 0.96366276 0.38344152] [0.79172504 0.52889492 0.56804456 0.92559664 0.07103606] numpy의 rand method로 랜덤한 숫자를 생성하면 위처럼 생성할때마다 다른 숫자가 return될겁니다. (같은 숫자가 return될 확률도 있지만 너무나도 적은 확률이겠죠.) import numpy as np np.random.seed(seed=0) arr_1 = np.random.rand(5) print(ar..

Python numpy library에는 난수(랜덤한 숫자)를 생성하는 method들이 있는데 어떤 것들이 있고 어떻게 사용할 수 있는지 알아봅시다. - numpy.random.rand() rand method는 0 이상 1 미만의 랜덤한 실수를 생성합니다. import numpy as np test_value = np.random.rand() print(test_value) -- Result 0.11999006968888681 import numpy as np test_value = np.random.rand(3) print(test_value) -- Result [0.56929945 0.43654139 0.87778867] 위 예시처럼 rand method에 숫자를 넣어주면 넣은 숫자의 길이만큼 랜덤..