일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Tkinter
- matplotlib
- numpy
- gas
- Kotlin
- dataframe
- Excel
- PANDAS
- array
- Python
- PostgreSQL
- 파이썬
- Apache
- Java
- google apps script
- string
- hive
- math
- Google Spreadsheet
- django
- GIT
- PySpark
- Github
- list
- SQL
- Google Excel
- c#
- Redshift
- Mac
- Today
- Total
목록Python (384)
달나라 노트
Python에서 rjust, ljust method의 사용법은 아래와 같습니다. string.rjust(number, text) string.ljust(number, text) rjust는 string에 적용할 수 있으며, string을 오른쪽으로 밀고 총 글자수가 number가 되도록 text를 왼쪽에 추가합니다. (string을 오른쪽으로 밀기 때문에 rjust =right just라고 생각합시다.) ljust는 string에 적용할 수 있으며, string을 왼쪽으로 밀고 총 글자수가 number가 되도록 text를 오른쪽에 추가합니다. (string을 왼쪽으로 밀기 때문에 ljust = left just라고 생각합시다.) 아래 예시를 봅시다. test_string = 'MAIN' rjust_str..
numpy의 argmax는 주어진 array에서 가장 큰 값을 찾고 이 값의 index를 return합니다. import numpy as np arr_test = np.array([2, 3, 1, 6, 3, 8, 2, 6]) index_of_max_value = np.argmax(arr_test) print(index_of_max_value) -- Result 5 arr_test에 있는 요소 중 가장 큰 값은 8입니다. arr_test에서 8이라는 값에 대한 index는 5입니다. 따라서 argmax는 5를 return합니다. import numpy as np arr_test = np.array([2, 3, 1, 6, 3, 8, 2, 6]) index_of_min_value = np.argmin(arr_..
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..