如何将SQLite3数据库导入Python Jupyter Notebook?

6
你如何将存储在计算机上的SQLite3数据库文件导入Python Jupyter笔记本中?
我的目标是能够像导入CSV文件时一样,在Python Pandas中分析数据。
1个回答

8
import sqlite3
import pandas as pd

# Create the connection
cnx = sqlite3.connect(r'C:\mydatabases\bigdata.db')

# create the dataframe from a query
df = pd.read_sql_query("SELECT * FROM userdata", cnx)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接