首页 > 解决方案 > 使用烧瓶应用程序检查数据框中的值变化

问题描述

使用此代码,我正在检查列中的值是否check_val为真,并创建Ticker要在 html 网页上呈现的列表。

由于列中的值check_val经常更改,为了确保呈现正确的列表,我使用 html 文件中的以下行每 10 秒调用一次此端点

<meta http-equiv="refresh" content="10">

.

@app.route('/check')
def check():
    filename = r'C:\Users\91956\Desktop\Book.xlsm'
    df = pd.read_excel(filename)

    df = df.loc[df['check_val'] == True]
    ticker_list = df['Ticker'].to_list()
 

    return render_template('layout.html',lis = ticker_list)

这会导致每 10 秒刷新一次页面。在不刷新页面的情况下,是否有其他替代方法可以完成此操作?

标签: pythonhtmlpandasflask

解决方案


推荐阅读