Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

df to sql mysql

import pymysql
user = 'root'
passw = 'my-secret-pw-for-mysql-12ud'
host =  '172.17.0.2'
port = 3306
database = 'data_2'

#If you already have the database created, if databse is not created then create first then run the below script

conn = pymysql.connect(host=host,
                       port=port,
                       user=user, 
                       passwd=passw,  
                       db=database,
                       charset='utf8')

data.to_sql(name=database, con=conn, if_exists = 'replace', index=False, flavor = 'mysql')
Comment

PREVIOUS NEXT
Code Example
Python :: import all csv python 
Python :: python unittest 
Python :: write to csv pandas 
Python :: prolog avg of list 
Python :: making a return from your views 
Python :: python how to see what pip packages are installed 
Python :: area of trapezium 
Python :: # decorator 
Python :: python split string into floats 
Python :: represent NaN with pandas in python 
Python :: json and python login system 
Python :: turtle keep window open 
Python :: python download file from ftp 
Python :: Video to text convertor in python 
Python :: python beginner projects 
Python :: add two column values of a datframe into one 
Python :: py hash 
Python :: insert single value in dataframe using index 
Python :: python compiler to exe 
Python :: how to run python file from cmd 
Python :: python string to list of int 
Python :: python check if string in string 
Python :: python compare objects 
Python :: concatenating datfra,esin pandas 
Python :: convert list to tuple python 
Python :: or statement python 
Python :: python selenium send keys enter send 
Python :: install glob module in linux 
Python :: streamlit install 
Python :: create new python environment check 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =