PyMySQL

Pandas DataFrame to MySQL Database using iris Data

개요 이전 강의에 이어서 진행한다. (MySQL Select Clause via Python) 임의의 Pandas 데이터 프레임에서 MySQL DB로 추가하는 코드를 작성한다. 주요 라이브러리 설치 아래와 같이 주요 라이브러리를 설치한다. MySQL과 관련된 주요 Python 라이브러리를 설치한다. pip install mysql-connector mysql-connector-python pymysql SQLAlchemy seaborn pandas 코드 작성(mysql-connector) 아래와 같이 코드를 작성한다. # 파일명 : db.py import mysql.connector import pandas as pd import seaborn as sns mydb = mysql.connector.connect( host = "localhost", user = "root", passwd = "evan", database = "muldb" ) print(mydb) iris_df = sns.