일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Google Excel
- PySpark
- GIT
- SQL
- Mac
- PostgreSQL
- c#
- string
- matplotlib
- Python
- Tkinter
- numpy
- Github
- Redshift
- Java
- Apache
- gas
- Kotlin
- 파이썬
- array
- Google Spreadsheet
- hive
- Excel
- dataframe
- PANDAS
- list
- google apps script
- math
- django
- Today
- Total
목록Python (384)
달나라 노트
Python에 있는 phonenumbers library는 입력한 핸드폰 번호의 간단한 정보를 알려줍니다. 바로 코드를 봅시다. import phonenumbers from phonenumbers import carrier, geocoder, timezone mobile_phone_number = '+821012345678' mobile_phone_number = phonenumbers.parse(mobile_phone_number) print('Time zone of the number ->', timezone.time_zones_for_number(mobile_phone_number)) print('Country of the number ->', geocoder.description_for_numbe..

회원가입을 할 때 보면 정보를 다 입력하고 마지막 부분에 이상하게 생긴 문자들을 입력하라고 하는것이 보통입니다. 위 이미지처럼요. 위와같은 것을 주로 Captcha라고 하는데 이번에는 Python으로 위 이미지처럼 특정 문자를 captcha로 만들어보겠습니다. pip install captcha 먼저 captcha library를 설치해줍니다. from captcha.image import ImageCaptcha image = ImageCaptcha(width=160, height=90) txt_captcha = '3ck8Bei' image.generate(txt_captcha) image.write(txt_captcha, 'captcha_result.png') 위 코드를 실행해보면 아래처럼 내가 원하는..
Python의 datetime library에는 utcnow라는 method가 있는데 이것은 현재 기준 UTC를 반환해줍니다. import datetime dt_utc = datetime.datetime.utcnow() print(dt_utc) -- Result 2021-10-27 17:08:51.097881 사용법은 상당히 간단합니다. utcnow() method만으로 UTC를 얻을 수 있습니다. utcnow()는 Python코드를 실행하는 서버나 컴퓨터의 시간에 상관없이 UTC값을 기준으로 계산되는 것이므로, 혹시나 컴퓨터의 시간이 이상하다거나 사용하는 서버의 시간이 이상할 경우 정확한 현재 시간/날짜를 얻기 위해 사용할 수 있습니다. import datetime dt_kst = datetime.da..

tabulate을 이용하여 DataFrame을 terminal에서 더 가독성 좋게(이쁘게) 출력하는 방법을 알아봅시다. import pandas as pd dict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': ['Apple', 'Banana', 'Watermelon', 'Grape', 'Melon'], 'col3': ['a', 'b', 'c', 'd', 'e'], } df_test = pd.DataFrame(dict_test) print(df_test) 위 코드를 실행해보면 그 결과로 아래 이미지와 같은 내용이 출력됩니다. 정상적으로 DataFrame이 출력되긴 했죠. 그러나 가독성이 그닥 좋아보이진 않습니다. 지금 예시로 사용된 DataFrame은 굉장히 간단해서 이것만으..