guopengfa
发布于 2020-05-28 / 782 阅读 / 0 评论 / 0 点赞

pandas读取数据库为Dataframe,pd.read_sql()

from sqlalchemy import create_engine
import pandas as pd
import pymysql

if name == 'main':
conn = pymysql.connect(
host = "218.0.27.8",
port = 10036,
user = "user",
passwd = "passwd",
db = "mrp_py"
)
data = pd.read_sql(sql="select * from sal23_222",con=conn)
print(data)


评论