当前位置:网站首页>The data read by pandas is saved to the MySQL database
The data read by pandas is saved to the MySQL database
2022-07-03 10:02:00 【Star soul is not a dream】
sudo cat /etc/mysql/debian.cnf
user = debian-sys-maint
password = xxxxx
import pandas as pd
from sqlalchemy import create_engine
host = '127.0.0.1'
db = 'test'
user = 'debian-sys-maint'
password = 'xxx'
print(str(r"mysql+pymysql://%s:" + '%s' + "@%s/%s") % (user, password, host, db))
engine = create_engine(str(r"mysql+pymysql://%s:" + '%s' + "@%s/%s") % (user, password, host, db))
try:
df = pd.DataFrame([[1,'x'],[2,'y']],columns=list('ab'))
df.to_sql('test1',con=engine,if_exists='replace',index=False)
except Exception as e:
print(e)边栏推荐
- 2020-08-23
- Introduction to chromium embedded framework (CEF)
- 03 FastJson 解决循环引用
- 要選擇那種語言為單片機編寫程序呢
- The third paper of information system project manager in soft examination
- Application of external interrupts
- SSB Introduction (PbCH and DMRs need to be supplemented)
- CEF download, compile project
- Fundamentals of Electronic Technology (III)__ Chapter 1 resistance of parallel circuit
- Interruption system of 51 single chip microcomputer
猜你喜欢

Quelle langue choisir pour programmer un micro - ordinateur à puce unique

內存數據庫究竟是如何發揮內存優勢的?

当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学

SSB Introduction (PbCH and DMRs need to be supplemented)

Oracle database SQL statement execution plan, statement tracking and optimization instance

How does the memory database give full play to the advantages of memory?

It is difficult to quantify the extent to which a single-chip computer can find a job

Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()

Fundamentals of Electronic Technology (III)__ Chapter 1 resistance of parallel circuit

03 FastJson 解决循环引用
随机推荐
Raspberry pie installation SciPy
Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
STM32 interrupt priority management
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
2020-08-23
Sending and interrupt receiving of STM32 serial port
【力扣刷题笔记(二)】特别技巧,模块突破,45道经典题目分类总结,在不断巩固中精进
STM32 serial port usart1 routine
is_ power_ of_ 2 judge whether it is a multiple of 2
getopt_ Typical use of long function
2. Elment UI date selector formatting problem
STM32 general timer 1s delay to realize LED flashing
Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
没有多少人能够最终把自己的兴趣带到大学毕业上
Code word in NR
Serial port programming
4G module at command communication package interface designed by charging pile
Screen display of charging pile design -- led driver ta6932
Emballage automatique et déballage compris? Quel est le principe?
[keil5 debugging] warning:enumerated type mixed with other type