| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- PANDAS
- Google Spreadsheet
- Redshift
- math
- c#
- google apps script
- array
- numpy
- Presto
- Python
- GIT
- PostgreSQL
- gas
- PySpark
- matplotlib
- string
- list
- django
- Kotlin
- 파이썬
- dataframe
- Google Excel
- Tkinter
- Excel
- Github
- Apache
- Java
- SQL
- hive
- Today
- Total
목록Python (388)
달나라 노트
import datetime dt = datetime.date(2020, 12, 25) print(dt) iso_data = dt.isocalendar() print(iso_data) print(iso_data[0]) # year print(iso_data[1]) # week number print(iso_data[2]) # week day number - Result 2020-12-25 (2020, 52, 5) 2020 52 5 isocalendar는 date or datetime에 대해 해당 날짜의 년도, 주차(week number), 요일(week day)을 포함한 Tuple 데이터를 반환합니다. 따라서 return된 Tuple의 index = 1인 숫자를 보면 week number를 얻을 수 있습..
2020-03-08이라는 날짜를 표현하는 방식은 다양합니다. 2020-03-08이라고 표현할 수도 있으며 2020/03/08, 03/08/2020, 03-08-2020, 08-03-2020 등등 여러 구분기호(-, / etc)와 년, 월, 일의 순서를 변경할 수도 있습니다. 이번 section에서는 이와 같이 날짜, 시간 데이터를 원하는 format에 맞춰 텍스트로 전환하는 방법을 알아보겠습니다. import datetime now = datetime.datetime.now() print(now) t0 = now.strftime("&H:%M:%S") print(t0) t1 = now.strftime("&H-%M-%S") print(t1) t2 = now.strftime("%m/%d/%Y, %H:%M:%S..
datetime class의 timedelta method는 특정한 시간의 양을 저장하며 이를 이용하여 어떤 시점으로부터 얼마만큼의 시간이 양이 차이났을 때 과연 어느 시점으로 변할지를 계산합니다. 아래 예시를 봅시다. import datetime d1 = datetime.date(year = 2020, month = 1, day = 1) d2 = datetime.date(year = 2020, month = 1, day = 10) d3 = d2 - d1 print(d3) d4 = datetime.datetime(2020, 1, 1, 0, 10, 20) d5 = datetime.datetime(2020, 1, 10, 10, 10, 20) d6 = d5 - d4 print(d6) print(type(d3)..
import datetime current_dt = datetime.datetime.now() print(current_dt) - Result 2020-03-08 02:13:52.703621 datetime 모듈의 class중에서 datetime이라는 class가 존재합니다. datetime class에 속한 now라는 moethod는 현재 local date와 time을 리턴합니다. import datetime current_dt = datetime.date.today() print(current_dt) - Result 2020-03-08 datetime 모듈의 class중에서 date라는 class가 존재합니다. date class에 속한 today라는 moethod는 현재 local date를 리턴..