-1
我想从一个函数返回一个值到另一个函数并使用它来过滤我的excel。下面是什么我试图做的事:从一个函数传递返回参数另一个函数
@app.route("/bzrules")
def show_tables():
rules = pd.read_excel('static/dummy_data.xlsx')
df = pd.read_excel('static/Book1.xlsx')
valid=pd.read_excel('static/rules.xls')
rules.set_index(['DR_ID'], inplace=True)
rules.index.name=None
allfields3=rules.loc[rules['DQ_Dimension']=='Accuracy']
allfields2 = allfields3[['Subject_Area','Field_Name']]
if request.method == 'GET':
subarealist = rules['Subject_Area'].unique().tolist()
validvalues=valid['Field_Name'].loc[valid['Rule_Type']=='Valid Value Check']
# this is were user selection from first function assigned to seach_key variable. i want to pass this variable to another function below.
在我先前的职位subarealist
是用户的选择。
在这一请求,我现在的储蓄在一个变量我的用户选择,并试图变量传递给另一个函数
search_key = request.args.get('fieldnames')
@app.route('/postfields')
def postfields():
# i tried doing like below, but getting errors
search_key=show_tables()
dt=pd.read_excel('static/AllDataSheets.xlsx',sheetname=search_key)
请不要转发问题。如果您已更新有关问题的信息,请编辑现有问题以显示该问题。 – davidism
哪个变量有你需要传递的用户选择?字段名是变量还是字符串? – brennan