Python3实现mysql连接和数据框的形成,具体代码如下所示: # -*- coding:utf-8 -*- # __author__ = "LQ" import pymysql import pandas as pd import numpy as np from sklearn import preprocessing #返回数据库连接 def dbcconnect(): conn = pymysql.connect(host='ip', port=3306, user='username', passwd='password',db='db') return conn #接