일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- math
- dataframe
- Excel
- gas
- string
- list
- PySpark
- SQL
- PostgreSQL
- Mac
- 파이썬
- array
- PANDAS
- GIT
- google apps script
- matplotlib
- Python
- hive
- c#
- Redshift
- Tkinter
- Github
- Google Excel
- django
- Apache
- numpy
- Google Spreadsheet
- Kotlin
- Java
- Today
- Total
목록Python (384)
달나라 노트
Python의 smtplib를 이용하면 mail을 보낼 수 있습니다. 예시 코드는 아래와 같습니다. 먼저 gmail을 이용한 예시입니다. import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart sender = 'sender@gmail.com' sender_pw = 'password' recipient = 'recipient@gmail.com' list_cc = ['cc1@gmail.com', 'cc2@naver.com'] str_cc = ','.join(list_cc) title = 'Test mail' contents = ''' This is test mail using smtpli..
replace method를 이용하면 어떤 문자열에서 특정 문자를 내가 원하는 다른 문자로 변경할 수 있습니다. replace의 syntax는 아래와 같습니다. text.replace(old_text, new_text, replace_count) text.replace = text에 replace를 적용합니다. old_text = text 속에서 바꿀 대상 문자열입니다. new_text = old_text를 지우고 그 자리에 새로 대체할 text입니다. replace_count = text에 old_text와 매칭되는 부분이 여러 개 있을 수 있는데 이 중 몇개를 replace할지에 대한 숫자를 적으면 됩니다. 만약 이 값을 적지 않으면 old_text와 매칭되는 모든 문자가 new_text로 변경됩니다..
Pandas로 DataFrame을 다루다보면 DataFrame data를 database에 load해야 할 경우가 있습니다. 따라서 아래처럼 create table 구문을 실행시켜 database table을 생성하고 해당 tabe에 insert하는 방법을 사용한다고 가정해봅시다. create table test_table ( col1 varchar, col2 bigint, col3 double ) 위 예시는 column이 3개밖에 없어서 다행이지만 만약 column이 30개인 DataFrame을 insert하려고 한다면 위 create table syntax에 column 30개에 대한 datatype을 일일이 적어줘야 할것입니다. 이는 너무 번거로운 작업이 아닐 수 없죠. pandas에는 위처럼 특정..

Python에서 input method는 python file 실행 시 잠깐 실행을 멈추고 user의 input값을 받을 수 있도록 합니다. input('input message') # 1 val_test = input('input message') # 2 Syntax는 위와 같습니다. 1. input을 적으면 바로 input 기능을 사용할 수 있으며, 괄호 안에 input을 요청할 때 출력할 메세지를 입력할 수 있습니다. (메세지를 입력하지 않아도 기능적으론 문제 없이 잘 실행됩니다.) 2. 2번처럼 input을 다른 변수에 할당하여 input받은 값을 저장할 수 있습니다. val_input = input('Please enter any key : ') print(val_input) 위 코드를 실행해보..