From CSV to SQLite3 by python 导入csv到sqlite实例
2020-03-11 16:53
766 查看
初次使用SQLite,尝试把之前一个csv文件导进去,看了网上各种教程,大多是在SQLite shell模式下使用的,比较麻烦,
这里用了panda,就方便多了,仅作示例供参考。
第一篇开博,想不好写什么,就把这个拎上来吧。
import pandas import csv, sqlite3 conn= sqlite3.connect("dbname.db") df = pandas.read_csv('d:\\filefolder\csvname.csv') df.to_sql('tablename', conn, if_exists='append', index=False) print('ok')
以上这篇From CSV to SQLite3 by python 导入csv到sqlite实例就是小编分享给大家的全部内容了,希望能给大家一个参考
您可能感兴趣的文章:
相关文章推荐
- [Project] Simulate HTTP Post Request to obtain data from Web Page by using Python Scrapy Framework
- [Project] Simulate HTTP Post Request to obtain data from Web Page by using Python Scrapy Framework
- [Project] Simulate HTTP Post Request to obtain data from Web Page by using Python Scrapy Framework
- Import CSV data to Sqlite. 导入CSV数据到SQLite
- Python3导入CSV文件的实例(跟Python2有些许的不同)
- 使用python将csv数据导入到sqlite中
- Loading Data From Oracle To Hive By ODI 12c
- How to avoid Excel from prompting "The file you are trying to open, , is in a different format than specified by the file extension"? (转)
- How to Bind Silverlight DataGrid From IEnumerable of IDictionary by Transforming Each Dictionary Key
- Mock an function to modify partial return value by special arguments on Python
- Step by Step Migration from Lync Server 2010 to Lync Server 2013
- CSV to HTML Table with Python
- string - How to get the filename without the extension from a path in Python? - Stack Overflow
- How to create physical standby database with 11g RMAN DUPLICATE FROM ACTIVE DATABASE [ID 747250.1]
- 忘记导入struts2-xxx-plugin-x.x.x.jar导致服务器启动报Unable to load configuration.Caused by: Parent package is not defined: xxx-default
- Import data from files to SQL Server(用BULK INSERT命令导入数据详解)
- Outlook Web Access (OWA) suffers from a vulnerability that allows direct access to files blocked by policy
- 详解Python中的from..import绝对导入语句
- Silverlight中的From/To/By动画学习
- C#中csv文件与DataTable互相导入处理实例解析