python db to dataframe code example
Example 1: sqlite to pandas
import pandas as pd
import sqlite3
con = sqlite3.connect('/Users/mac/Desktop/Python/Baye_stat/productiondisruption/PCI_meat.sqlite')
df = pd.read_sql(<your query here>, con)
Example 2: pandas sql commands
SQL_Query = pd.read_sql_query(
'''select
product_name,
product_price_per_unit,
units_ordered,
((units_ordered) * (product_price_per_unit)) AS revenue
from tracking_sales''', conn)