일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
31 |
- google apps script
- Excel
- SQL
- Java
- list
- matplotlib
- array
- Github
- Apache
- 파이썬
- Kotlin
- Redshift
- math
- c#
- PANDAS
- string
- Google Excel
- GIT
- numpy
- gas
- dataframe
- Mac
- Tkinter
- PostgreSQL
- hive
- PySpark
- django
- Python
- Google Spreadsheet
- Today
- Total
목록Python (384)
달나라 노트
numpy의 split method는 array를 나눠서 새로운 array를 생성해주는 역할을 합니다. 바로 예시를 보시죠. import numpy as np arr_base = np.array([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) print(arr_base) arr = np.split(arr_base, 2) print(arr[0]) print(arr[1]) -- Result [10 9 8 7 6 5 4 3 2 1] [10 9 8 7 6] [5 4 3 2 1] split method는 위처럼 사용할 수 있습니다. 첫 번쨰 인자로 나눌 array를 전달합니다. 두 번째 인자로 array를 몇 부분으로 나눌지를 전달합니다. 위 예시에서는 arr_base를 두 부분으로 나누라고 되어있습니..

numpy의 normal method는 특정 구간 사이의 값을 정규분포의 형태로 추출해줍니다. numpy의 uniform method는 특정 구간 사이의 값을 균등분포의 형태로 추출해줍니다. 이게 무슨 소린지 지금은 잘 감이 안올겁니다. 실제 예시를 보시죠. 먼저 normal method (정규분포)를 봅시다. import numpy as np arr_normal_distribution = np.random.normal(loc=0, scale=10, size=10000) print(arr_normal_distribution) -- Result [ 6.95222556 -5.13843794 1.64328595 ... -10.97587735 18.23262221 -21.6592955 ] normal metho..

히스토그램(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하는걸 확인할 수 있습니다.