I've been working on an SQL Basics project in Python and this is my code. When I run it, it should display my lines in a table but it doesn't. Using print(run_query(query))
works, but not the way I wrote it here:
import sqlite3
import pandas as pd
db = sqlite3.connect("hubway.db")
def run_query(query):
return pd.read_sql_query(query, db)
query = 'SELECT * FROM trips LIMIT 5;'
run_query(query)
All of this is from https://www.dataquest.io/blog/sql-basics/. The database is nothing complicated, just two tables that contain some columns with data.