campaign/queries.py
def query_db(index, cur):

    """This function will take an index input and then return an array of information based on the index""" 

    query_db = "SELECT danceability, energy, key, loudness, mode, speechiness, acousticness, instrumentalness, liveness, valence, tempo, duration_ms from features WHERE index = \'" + str(index[0]) + "\'"
    cur.execute(query_db)
    results = cur.fetchone()
    results_list = list(results)
    results_list[-1] = results_list[-1] / 6061090
    results_list[2] = results_list[2] / 11
    results_list[3] = (results_list[3] - (-60.0)) / (7.234 - (-60.0))
    results_list[10] = results_list[10] / 248.934
    arr = np.array(results_list)
    
    return arr
This function will take an index input and then return an array of information based on the index
This function will take an index input and then return an array of information based on the index
This function will take an index input and then return an array of information based on the index
def query_db(index, cur):
    query_db = "SELECT danceability, energy, key, loudness, mode, speechiness, acousticness, instrumentalness, liveness, valence, tempo, duration_ms from features WHERE index = \'" + str(index[0]) + "\'"
    cur.execute(query_db)
    results = cur.fetchone()
    results_list = list(results)
    results_list[-1] = results_list[-1] / 6061090
    results_list[2] = results_list[2] / 11
    results_list[3] = (results_list[3] - (-60.0)) / (7.234 - (-60.0))
    results_list[10] = results_list[10] / 248.934
    arr = np.array(results_list)
    return arr
def query_db ( index , cur ) : query_db = "SELECT danceability, energy, key, loudness, mode, speechiness, acousticness, instrumentalness, liveness, valence, tempo, duration_ms from features WHERE index = \'" + str ( index [ 0 ] ) + "\'" cur . execute ( query_db ) results = cur . fetchone ( ) results_list = list ( results ) results_list [ - 1 ] = results_list [ - 1 ] / 6061090 results_list [ 2 ] = results_list [ 2 ] / 11 results_list [ 3 ] = ( results_list [ 3 ] - ( - 60.0 ) ) / ( 7.234 - ( - 60.0 ) ) results_list [ 10 ] = results_list [ 10 ] / 248.934 arr = np . array ( results_list ) return arr
This function will take an index input and then return an array of information based on the index
This function will take an index input and then return an array of information based on the index
"""This function will take an index input and then return an array of information based on the index"""
index
cur