Skip to content

Instantly share code, notes, and snippets.

@jonathan-nwosu
Created September 10, 2019 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathan-nwosu/7b1a5bf26361d4a2fa476ee3cfeb7e6b to your computer and use it in GitHub Desktop.
Save jonathan-nwosu/7b1a5bf26361d4a2fa476ee3cfeb7e6b to your computer and use it in GitHub Desktop.
import csv, sqlite3
import pandas as pd
import numpy as np
con = sqlite3.connect("exercise_database.db")
query_one = pd.read_sql_query("SELECT iso, AVG(score) AS averageScore FROM reviews GROUP BY iso", con)
print(query_one)
query_two = pd.read_sql_query("SELECT app_bought_bucket, MAX(score) AS maxScore FROM reviews GROUP BY app_bought_bucket", con)
print(query_two)
query_three = pd.read_sql_query("SELECT date, AVG(score) AS averageScore FROM reviews GROUP BY date", con)
print(query_three)
con.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment