Python 通过短划线中的回调从dataframe加载数据

Python 通过短划线中的回调从dataframe加载数据,python,pandas,plotly,hyphen,Python,Pandas,Plotly,Hyphen,正在形成数据表。从csv文件加载的数据 表格编号: df =None if os.path.isfile('patient_filter.csv'): df = pd.read_csv("patient_filter.csv") def update_patient_record(dataframe): if os.path.isfile('patient_filter.csv'): id=dataframe['id'].values

正在形成数据表。从csv文件加载的数据

表格编号:

df =None

if os.path.isfile('patient_filter.csv'):
    df = pd.read_csv("patient_filter.csv")


def update_patient_record(dataframe):
    if os.path.isfile('patient_filter.csv'):

    id=dataframe['id'].values
    day=dataframe['AnalyzeTime'].values
    pfn=dataframe['Patient first name'].values
    pln=dataframe['Patient last name'].values
    pdb=dataframe['Patient day of birth'].values
    study=dataframe['Study'].values
    status=dataframe['Status'].values
    return [

    dbc.FormGroup(
    [
        dbc.Label('id', html_for='id'),
        dbc.Input(
            id = 'id',
            type = 'number',
            value=id[0]
        ),
        ]),

    dbc.FormGroup(
    [
        dbc.Label('AnalyzeTime', html_for='at'),
        dbc.Input(
            id = 'day',
            type='text',
            value=day[0]
            ),

    ]),

    dbc.FormGroup(
    [
        dbc.Label('Patient first name', html_for='pfn'),
        dbc.Input(
            id = 'pfn',
            type='text',
            value=pfn[0]
        ),
    ]),
    dbc.FormGroup(
    [
        dbc.Label('Patient last name', html_for='pln'),
        dbc.Input(
            id = 'pln',
            type='text',
            value=pln[0]
        ),
    ]),
    dbc.FormGroup(
    [
        dbc.Label('Patient day of birth',html_for='pdb'),
        dbc.Input(
            id='pdb',
            type='text',
            value=pdb[0]
        ),
    ]),
    dbc.FormGroup(
    [
        dbc.Label('Study',html_for='study'),
        dbc.Input(
            id='study',
            type='text',
            value=study[0]
        ),
    ]),
    dbc.FormGroup(
    [
        dbc.Label('Status',html_for='status'),
        dbc.Input(
            id='status',
            type='text',
            value=status[0]
        ),
    ]),
]

此处调用“更新患者记录”功能:

layout = dbc.Container(
fluid=True,
children=[
html.H1([dbc.Badge("Patient Record", className="pr", color='dark')]),
html.Br(),

dbc.Row([
    dbc.Col(id='tab-patient',style=TAB_STYLE,width=4,children=update_patient_record(df)),
]),],),
csv文件会定期更改,但数据表在我重新启动服务器之前不会更改。如何正确编写回调以加载新数据?我不明白怎么做