일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Google Excel
- Apache
- google apps script
- Java
- gas
- Github
- PySpark
- PostgreSQL
- math
- SQL
- Google Spreadsheet
- Excel
- Redshift
- Tkinter
- django
- list
- string
- array
- Mac
- PANDAS
- hive
- numpy
- Kotlin
- dataframe
- 파이썬
- Python
- GIT
- matplotlib
- c#
- Today
- Total
목록Python/Python ETC (57)
달나라 노트
pyhive 라이브러리는 python에서 서버에 접근하여 Hive SQL query를 실행할 수 있도록 해줍니다. 이번에는 pyhive 라이브러리를 이용해서 Hive query를 돌리는 예시를 봐봅시다. 아래 코드가 가장 기본적인 pyhive 사용 예시입니다. from pyhive import hive import pandas as pd hive_con = hive.Connection( host='test_host', port=10000, username='test_user_id', password='test_user_password', database='default', auth='LDAP' ) cursor = hive_con.cursor() test_query = ''' select tt.id, tt..

Python에서는 굉장히 간단하게 URL을 QR Code로 전환시켜주는 library가 있습니다. 이것을 한번 알아보죠. pip install qrcode 먼저 qrcode library를 설치해줍시다. import qrcode url = 'https://www.google.com' qr_img = qrcode.make(url) qr_img.save(stream='qr_code.png') 위 코드를 실행하면 qr_code.png라는 이미지 파일이 생성되며 그 파일은 아래와 같습니다. QR Code를 카메라로 비추면 www.google.com으로 이동됩니다. 굉장히 간단하죠? pip install pyqrcode 이번에는 pyqrcode라는 library를 이용해봅시다. pip install pypng 이..
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') 위 코드를 실행해보면 아래처럼 내가 원하는..