Answers for "how to import data to mysql with pandas"

3

mysql to df

import mysql.connector
import pandas as pd

db_connection = mysql.connector.connect(
  host="localhost",
  user="user",
  password="password",
  database="dbname",
  auth_plugin='mysql_native_password'
)

df = pd.read_sql("select * from table_name;", con=db_connection)
print(df)
Posted by: Guest on July-06-2020

Code answers related to "how to import data to mysql with pandas"

Python Answers by Framework

Browse Popular Code Answers by Language