| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- list
- hive
- GIT
- PANDAS
- Kotlin
- PySpark
- string
- Google Spreadsheet
- c#
- google apps script
- math
- Presto
- Excel
- matplotlib
- Tkinter
- django
- PostgreSQL
- Python
- Apache
- Java
- Redshift
- Google Excel
- Github
- array
- numpy
- gas
- dataframe
- 파이썬
- SQL
- Today
- Total
목록Python (387)
달나라 노트
import calendar print(calendar.prmonth(2020, 3)) calendar.prmonth 함수를 이용해 2020년의 3월 달력을 출력할 수 있습니다.
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(..