Verwenden Sie SQLalchemy, um die SQLite3 -Datenbank zu erstellen
from sqlalchemy import create_engine
import pandas as pd
# creates an engine for a database in current directory
engine = create_engine('sqlite:///yourDatabaseName.sqlite3')
# creates a dataframe in memory
df = pd.DataFrame({'tablename' : ['Data 1', 'Data 2', 'Data 3']})
# stores the dataframe as a table in the database
df.to_sql('tablename', con=engine)
# queries the table and stores the results in another dataframe
dfOne = pd.read_sql_table('tablename', engine)
# or you can create a custom sql query and store the results in a dataframe
dfTwo = pd.DataFrame(engine.execute("SELECT * FROM tablename").fetchall())
Trained Tuna