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

maplotlib의 scatter method는 점 그래프를 그려줍니다. 쉽게말해 점과 점을 이어주는 선 없이 오로지 점만을 나타내줍니다. import matplotlib.pyplot as plt list_x = [1, 2, 3, 4, 5] list_y = [10, 30, 15, 20, 5] plt.scatter(list_x, list_y, marker='o', s=30, c='lightgreen', edgecolors='black') plt.title('Test graph') plt.xlabel('date') plt.ylabel('amount') plt.show() scatter method는 사용법이 plot method와 거의 동일합니다. (plot method 관련 = https://cosmosp..
Python의 빌트인 함수인 any, all method를 알아봅시다. any, all method를 간략하게 정리해보면 아래와 같습니다. any : 전달받은 요소 중 하나 이상이 True일 경우 True return. (모든 요소가 False인 경우 False return) all : 전달받은 요소 전부가 True일 경우 True return. (하나라도 False가 있을 경우 False return) 또한 any, all method의 주의점은 list나 tuple같은 반복 가능한(iterable) 데이터를 parameter로서 받는다는 것입니다. 다음 예시를 보시죠. print(any([True, True])) # Result --> True print(any([True, False])) # Res..
pyhive 라이브러리는 python에서 서버에 접근하여 Hive SQL query를 실행할 수 있도록 해줍니다. 이번에는 pyhive 라이브러리를 이용해서 Hive query를 돌리는 예시를 봐봅시다. 아래 코드가 가장 기본적인 pyhive 사용 예시입니다. from pyhive import hive import pandas as pd hive_con = hive.Connection( host='test_host', port=10000, username='test_user_id', password='test_user_password', database='default', auth='LDAP' ) cursor = hive_con.cursor() test_query = ''' select tt.id, tt..