일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Excel
- math
- matplotlib
- Kotlin
- gas
- numpy
- hive
- 파이썬
- Python
- Tkinter
- Apache
- PANDAS
- PostgreSQL
- Google Spreadsheet
- PySpark
- SQL
- dataframe
- Java
- GIT
- c#
- Mac
- Redshift
- list
- array
- django
- Google Excel
- Github
- google apps script
- string
- Today
- Total
목록Python (384)
달나라 노트
numpy의 min, max method는 각각 주어진 값들 중 최소값, 최대값을 return합니다. import numpy as np arr_test = np.array([1, 2, 3, 4, 5]) print(arr_test) print(np.min(arr_test)) print(np.max(arr_test)) -- Result [1 2 3 4 5] 1 5 arr_test에서 각각 최소값, 최대값이 return됩니다. import numpy as np arr_test = np.array( [ # 1차 array [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] # 2차 array ] ) print(arr_test) print(np.min(arr_tes..
numpy의 tolist method는 array를 python의 list로 바꿔줍니다. 변경할 때 array의 차원을 그대로 유지합니다. 2차원 array에 tolist를 적용시키면 list속에 다른 list가 있는 2차원 list의 형태로 반환해준다는 의미이죠. 아래 예시들을 봅시다. import numpy as np arr_test = np.array( [1, 2, 3, 4, 5] # 1차 array ) list_test = arr_test.tolist() print(arr_test) print(list_test) -- Result [1 2 3 4 5] [1, 2, 3, 4, 5] import numpy as np arr_test = np.array( [ # 1차 array [1, 2, 3, 4, ..
import numpy as np arr_test = np.array([1, 2, 3, 4, 5]) arr_test_2 = arr_test arr_test_2[1] = 10 print(arr_test) print(arr_test_2) 위 예시를 봅시다. arr_test에 [1, 2, 3, 4, 5]를 array로 만들어서 할당했습니다. 그리고 arr_test_2 변수에 arr_test를 그대로 할당하교있죠. 이 시점에서 arr_test == arr_test_2일 것입니다. arr_test_2[1] = 10 그리고 arr_test_2의 index = 1 값을 10으로 바꿨죠. 그러면 당연히 arr_test_2는 아래와 같이 바뀔겁니다. [ 1 10 3 4 5] 그러면 이때 arr_test는 [1 2 3 4..
numpy의 zeros method는 0으로만 채워진 array를 생성합니다. 아래 예시들을 봅시다. import numpy as np arr_test = np.zeros(shape=3) print(arr_test) -- Result [0. 0. 0.] zeros(3)의 의미는 3개의 0을 요소로서 가지는 1차원 array를 생성하라는 의미입니다. 이렇게 zeros는 기본적으로 1차원 array를 생성합니다. import numpy as np arr_test = np.zeros(shape=3, dtype=int) print(arr_test) -- Result [0 0 0] 위 예시처럼 dtype 옵션을 이용해서 data type을 명시해줄 수 있습니다. 위 예시는 0의 data type을 모두 정수(in..