일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 파이썬
- gas
- Github
- Kotlin
- Redshift
- Python
- PySpark
- Tkinter
- dataframe
- Google Excel
- google apps script
- Java
- Google Spreadsheet
- PANDAS
- numpy
- math
- PostgreSQL
- hive
- matplotlib
- c#
- GIT
- array
- string
- django
- SQL
- Excel
- Mac
- list
- Apache
- Today
- Total
목록Python/Python numpy (38)
달나라 노트
numpy에서는 sinh, cosh, tanh의 삼각함수도 제공합니다. import numpy as np value = np.sinh(3) print(value) value = np.cosh(3) print(value) value = np.tanh(3) print(value) -- Result 10.017874927409903 10.067661995777765 0.9950547536867305 사용법은 간단합니다. sinh, cosh, tanh method의 paramter로 어떤 값을 전달하면 그 값에 대한 sinh, cosh, tanh 값을 계산해줍니다. import numpy as np value_list = [1, 2, 3, 4, 5] value_arr = np.array([1, 2, 3, 4, ..
numpy의 sqrt는 어떤 수의 제곱근을 계산해줍니다. import numpy as np test_value = np.sqrt(1) print(test_value) test_value = np.sqrt(4) print(test_value) test_value = np.sqrt(9) print(test_value) -- Result 1.0 2.0 3.0 사용법은 간단합니다. 위처럼 그냥 어떤 값을 sqrt method의 parameter로 전달하면 그 값의 제곱근을 계산해줍니다. import numpy as np value_list = [1, 2, 4, 9, 16] result = np.sqrt(value_list) print(result) value_arr = [1, 2, 4, 9, 16] result..
numpy에서는 log함수를 지원합니다. 기본적으로 다음과 같이 3가지가 있습니다. numpy.log() = 밑이 e(자연 상수)인 log numpy.log2() = 밑이 2인 log numpy.log10() = 밑이 10인 log import numpy as np result = np.log(np.e) print(result) result = np.log2(2) print(result) result = np.log10(10) print(result) -- Result 1.0 1.0 1.0 numpy의 log method는 위처럼 사용할 수 있습니다. log method의 괄호 안에 log를 적용할 값을 넣어주면 되는것이죠. import numpy as np arr_test = np.array([1, 2..
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에 숫자를 넣어주면 넣은 숫자의 길이만큼 랜덤..