Answers for "python save pandas dataframe as sqlite table"

SQL
2

convert sqlite table to pandas dataframe

import sqlite3
import pandas as pd

dat = sqlite3.connect('data.db')
query = dat.execute("SELECT * From <TABLENAME>")
cols = [column[0] for column in query.description]
results= pd.DataFrame.from_records(data = query.fetchall(), columns = cols)
Posted by: Guest on September-03-2020
1

how to transfer pandas datafra,e to sqlite

import sqlite3 as db
# Create your connection.
conn = db.connect('connection_name')
df.to_sql(name='table_name', con=conn)
Posted by: Guest on September-03-2020

Code answers related to "python save pandas dataframe as sqlite table"

Code answers related to "SQL"

Browse Popular Code Answers by Language