From 69b81f679d05d3dcffe99fb27612400d4d0b9d7f Mon Sep 17 00:00:00 2001 From: Priyansh Date: Thu, 9 Dec 2021 01:40:24 -0500 Subject: Refactor code and time_series_model.py now builds a pickle file --- sql_functions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sql_functions.py') diff --git a/sql_functions.py b/sql_functions.py index 313c449..54d1d05 100644 --- a/sql_functions.py +++ b/sql_functions.py @@ -1,6 +1,7 @@ import sqlite3 as sql import pandas as pd + def execute_sql_statement(sql_statement): conn = sql.connect("database.db") cur = conn.cursor() @@ -8,11 +9,13 @@ def execute_sql_statement(sql_statement): rows = cur.fetchall() return rows + def run_sql_pandas(sql_statement): conn = sql.connect("database.db") - df=pd.read_sql_query(sql_statement, conn).to_records(index=False) + df = pd.read_sql_query(sql_statement, conn).to_records(index=False) return df + def get_list_of_dict(keys, list_of_tuples): - list_of_dict = [dict(zip(keys, values)) for values in list_of_tuples] - return list_of_dict \ No newline at end of file + list_of_dict = [dict(zip(keys, values)) for values in list_of_tuples] + return list_of_dict -- cgit v1.2.3