일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- GIT
- Mac
- math
- 파이썬
- Java
- SQL
- PySpark
- Github
- Excel
- dataframe
- c#
- Google Spreadsheet
- Google Excel
- list
- string
- PANDAS
- matplotlib
- Tkinter
- google apps script
- Python
- gas
- Kotlin
- hive
- django
- array
- numpy
- PostgreSQL
- Apache
- Redshift
- Today
- Total
목록Python (384)
달나라 노트

히스토그램(Histogram)이란 x축을 값, y축은 x축의 값들이 나온 횟수(또는 개수)를 나타낸 그래프입니다. 여기서 x축을 계급, 횟수나 개수를 나타내는 y축을 도수라고 하는데 크게 중요하진 않습니다. matplotlibe의 hist method는 이러한 histogram을 그릴 수 있도록 해줍니다. import matplotlib.pyplot as plt value_list = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10] plt.hist(value_list) plt.xlabel('number') plt.ylabel('count') plt.show() 위 예시..
numpy의 random.shuffle method는 array속 요소들을 랜덤한 순서로 섞어줍니다. import numpy as np arr_1 = np.array([1, 2, 3, 4, 5]) np.random.shuffle(arr_1) print(arr_1) -- Result [4 2 3 5 1] 위 예시를 보면 array 속 요소들의 순서가 바뀐 것을 볼 수 있습니다. 위 코드를 실행할 때 마다 다른 순서로 섞인 array를 return하는걸 확인할 수 있습니다.
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..

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, ..