반응형
import pymysql
import numpy
import pandas as pd
conn = pymysql.connect(host="HOST IP 주소 ", port=3306, user=' DB USER ID', passwd='DB USER PW', db='DATABASE NAME', charset='utf8',
cursorclass=pymysql.cursors.DictCursor)
cursor = conn.cursor()
cursor.execute("select * from test")
res= cursor.fetchall()
print(res) #제이슨 형식
df = pd.DataFrame(res)
print(df.describe())
print(df.dtypes)
print(df.shape)
반응형
'지식창고 > DB' 카테고리의 다른 글
[Postgres SQL] Rocky 8.9 설치 방법 (0) | 2024.05.29 |
---|---|
[DB] MySQL(Error: Every derived table must have its own alias) (0) | 2020.09.30 |