make_dataset.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:UK_Imbalance_Price_Forecasting 作者: ADGEfficiency 项目源码 文件源码
def query_sql(db_path, table_name):
    """
    Uses pandas to pull data from our sqlite database

    args
        db_path (str) : location of the database
        table_name (str) : name of the table we want

    returns
        data (pd.DataFrame) :
    """
    print('Pulling data for table {} from {}'.format(db_path, table_name))
    #  connect to our database
    conn = sqlite3.connect(db_path)
    #  pull data by selecting the entire table
    data = pd.read_sql(sql='SELECT * from '+str(table_name), con=conn)
    data.set_index('index', drop=True, inplace=True)
    #  close the connection
    conn.close()
    return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号