Read an SQLite File
Let's find out how to use SQL with pandas DataFrame.
We'll cover the following...
Try it yourself
Try executing the code below to see the result.
Press + to interact
import sqlite3import pandas as pdconn = sqlite3.connect(':memory:')conn.executescript('''CREATE TABLE visits (day DATE, hits INTEGER);INSERT INTO visits VALUES('2020-07-01', 300),('2020-07-02', 500),('2020-07-03', 900);''')df = pd.read_sql('SELECT * FROM visits', conn)print('time span:', df['day'].max() - df['day'].min())
...