当前位置:网站首页>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)边栏推荐
- Vector processor 9_ Basic multilevel interconnection network
- 我想各位朋友都应该知道学习的基本规律就是:从易到难
- Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
- 4G module board level control interface designed by charging pile
- 学习开发没有捷径,也几乎不存在带路会学的快一些的情况
- SSB Introduction (PbCH and DMRs need to be supplemented)
- Timer and counter of 51 single chip microcomputer
- MySQL 数据库基础知识(系统化一篇入门)
- 內存數據庫究竟是如何發揮內存優勢的?
- 要选择那种语言为单片机编写程序呢
猜你喜欢

Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit

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

yocto 技術分享第四期:自定義增加軟件包支持

Yocto Technology Sharing Phase 4: Custom add package support

Eight working modes of stm32gpio and chip naming rules

Project cost management__ Cost management technology__ Article 6 prediction

Yocto technology sharing phase IV: customize and add software package support

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

Notes on C language learning of migrant workers majoring in electronic information engineering

Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5
随机推荐
Which language should I choose to program for single chip microcomputer
When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn
There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way
Code word in NR
Oracle database SQL statement execution plan, statement tracking and optimization instance
El table X-axis direction (horizontal) scroll bar slides to the right by default
嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走
SCM career development: those who can continue to do it have become great people. If they can't endure it, they will resign or change their careers
Stm32f407 key interrupt
SCM is now overwhelming, a wide variety, so that developers are overwhelmed
Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
Blue Bridge Cup for migrant workers majoring in electronic information engineering
Project cost management__ Topic of comprehensive calculation
Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
My 4G smart charging pile gateway design and development related articles
开学实验里要用到mysql,忘记基本的select语句怎么玩啦?补救来啦~
Getting started with JMX, MBean, mxbean, mbeanserver
Hal library sets STM32 clock
2. Elment UI date selector formatting problem