일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Apache
- GIT
- Tkinter
- PANDAS
- Mac
- gas
- hive
- Python
- Redshift
- Google Excel
- array
- PostgreSQL
- numpy
- string
- google apps script
- PySpark
- Excel
- Java
- 파이썬
- SQL
- math
- django
- list
- c#
- Google Spreadsheet
- Kotlin
- dataframe
- matplotlib
- Github
- Today
- Total
목록Python (384)
달나라 노트
import calendar print(calendar.weekday(2020, 3, 10)) - Output 1 calendar.weekday 함수를 2020년 3월 10일의 요일 정보를 추출합니다. 각 요일별 index 번호는 아래와 같습니다. 월요일 = 0 화요일 = 1 수요일 = 2 목요일 = 3 금요일 = 4 토요일 = 5 일요일 = 6
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을 ..