일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- hive
- Google Excel
- c#
- Kotlin
- Java
- Apache
- Github
- Mac
- matplotlib
- array
- PostgreSQL
- PANDAS
- gas
- SQL
- Redshift
- Tkinter
- math
- numpy
- dataframe
- list
- google apps script
- Google Spreadsheet
- GIT
- PySpark
- Python
- 파이썬
- string
- django
- Excel
- Today
- Total
목록Python (384)
달나라 노트
calendar module calendar module은 python에서 달력을 볼 수 있게 해줍니다. calendar : 특정 년도의 달력 보기 import calendar print(calendar.calendar(2020)) 위 코드는 2020년의 1월~12월 달력을 모두 출력해줍니다. import calendar print(calendar.prcal(2020)) calendar.calendar 함수와 동일한 기능으로 calendar.prcal 함수를 사용할 수도 있습니다.
python filter 함수는 list에서 원하는 데이터만을 filtering할 수 있도록 해줍니다. 바로 예시를 보시죠. list_test = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] def filter_condition(x): if x >= 5: return x else: pass list_test_new = list(filter(filter_condition, list_test)) print(list_test_new) - Output [5, 6, 7, 8, 9, 10] 위 코드는 1부터 10까지의 저어수를 가진 list에서 5 이상인 정수만을 골라서 list로 만드는 코드입니다. def filter_condition(x) -> 먼저 filter method에서 filtering을 ..
from pyhive import hive def query_execute_hive(query, result_cols): hive_connection = hive.Connection( host='host_name_url', port=10000 # port_number, username='hive_user_id', password='hive_user_password', database='default', auth='LDAP' ) cursor = hive_connection.cursor() raw_query_list = query.split(';\n') raw_query_list = [str(x).strip() for x in raw_query_list] raw_query_list = list(filter(..
import psycopg2 import pandas as pd def query_runner(query): dbname = 'sandbox' host = 'test_host' port = 1111 # port_number user_id = 'redshift_user_id' password = 'redshift_user_name' connection_info = "dbname='{}' host='{}' port={} user='{}' password='{}'".format(dbname, host, port, user_id, password) connection = psycopg2.connect(connection_info) cursor = connection.cursor() cursor.execute(q..