# 全部使用python内置库~~
import pymysql
import pandas as pd
from sqlalchemy import create_engine
file = r'ceshi.xlsx'
df = pd.read_excel(file, sheet_name=0)
# 注意:首先你需要建立数据库 本例用 ceshi
engine = create_engine("mysql+pymysql://root:root@localhost:3306/ceshi", encoding='gbk')
# python是数据库的表名
df.to_sql('python', con=engine, if_exists='replace', index=False)
了解函数的详细功能(以pycharm为例),按住Ctrl + B 查看函数功能