def update_table(the_location, the_benchmark, clicks): if clicks % 2 == 0: if not all((the_benchmark, the_location)): the_location = location_start the_benchmark = bench_start df_perf_summary = fm.fin_met(ticker_start, the_benchmark) else: df_perf_summary = fm.fin_met(ticker_start, the_benchmark) else: df_perf_summary = fm.fin_met(tickers_bench[the_benchmark], ticker_start) modifed_perf_table = make_dash_table(df_perf_summary) modifed_perf_table.insert( 0, html.Tr([ html.Td([]), html.Td(['Company'], colSpan=4, style={'text-align': "center"}), html.Td(['Benchmark'], colSpan=4, style={'text-align': "center"}) ], style={ 'background': 'white', 'font-weight': '600' })) return modifed_perf_table
def dadr(diffy): diffy = json.loads(diffy) dict_items = global_store(diffy["the_location"], diffy["the_benchmark"], diffy["clicks"]) df_perf_summary = fm.fin_met(dict_items["Benchmark"], dict_items["Company"]) def make_dash_table(df): ''' Return a dash definitio of an HTML table for a Pandas dataframe ''' table = [] for index, row in df.iterrows(): html_row = [] for i in range(len(row)): html_row.append(html.Td([row[i]])) table.append(html.Tr(html_row)) return table modifed_perf_table = make_dash_table(df_perf_summary) modifed_perf_table.insert( 0, html.Tr([ html.Td([]), html.Td(['Company'], colSpan=4, style={'text-align': "center"}), html.Td(['Benchmark'], colSpan=4, style={'text-align': "center"}) ], style={ 'background': 'white', 'font-weight': '600' })) return modifed_perf_table
diffy["first_option_target_code"]]["Company Metrics"] dict_info_output = ext_info_dict[ diffy["first_option_target_code"]]["Stakeholder Description"] c_metrics_df_output_1 = ext_info_dict[ diffy["first_option_target_code"]]["Company Metrics"] stock_plot_desc_output, _ = describe(diffy["first_option_target_code"], diffy["first_option_bench_code"]) title_output = str(diffy["first_option_target_long_name"]) + " 4-D Report" location_output = str(diffy["target_location_address"]) + " Location" profile_output = str( diffy["first_option_target_location_small_name"]) + " Profile" df_perf_summary_output = fm.fin_met(diffy["first_option_bench_code"], diffy["first_option_target_code"]) first_dict = {} #first_dict[""] first_dict[ "target_location_small_drop_down_options"] = target_location_small_drop_down_options first_dict["bench_code_drop_down_options"] = bench_code_drop_down_options first_dict[ "first_option_target_location_small_name"] = first_option_target_location_small_name first_dict["first_option_target_code"] = first_option_target_code first_dict["first_option_bench_code"] = first_option_bench_code first_dict["s_metrics_df_output"] = s_metrics_df_output first_dict["dict_info_output"] = dict_info_output first_dict["c_metrics_df_output"] = c_metrics_df_output
def make_dash_table(df): ''' Return a dash definitio of an HTML table for a Pandas dataframe ''' table = [] for index, row in df.iterrows(): html_row = [] for i in range(len(row)): html_row.append(html.Td([row[i]])) table.append(html.Tr(html_row)) return table ## #df_perf_summary = pd.read_csv("17530.csv") df_perf_summary = fm.fin_met(ticker_start, bench_start) modifed_perf_table = make_dash_table(df_perf_summary) modifed_perf_table.insert( 0, html.Tr([ html.Td([]), html.Td(['Company'], colSpan=4, style={'text-align': "center"}), html.Td(['Benchmark'], colSpan=4, style={'text-align': "center"}) ], style={ 'background': 'white', 'font-weight': '600' }))
desc = describe(diffy["code_start"], diffy["the_benchmark"]) stock_plot_desc_output = desc title = str(diffy["code_start_small"]) + " 4-D Report" title_output = title title = str(diffy["long_addy"]) + " Location" location_output = title title = str(diffy["the_location"]) + " Profile" profile_output = title df_perf_summary_output = fm.fin_met(diffy["the_benchmark"], diffy["code_start"]) df_perf_summary_output = fm.fin_met(diffy["the_benchmark"], diffy["code_start"]) first_dict = {} first_dict["locas_output"] = locas_output first_dict["benchy_output"] = benchy_output first_dict["first_option_coy_output"] = first_option_coy_output first_dict["code_start"] = code_start first_dict["the_benchmark"] = the_benchmark first_dict["s_metrics_df_output"] = s_metrics_df_output first_dict["c_metrics_df_output"] = c_metrics_df_output first_dict["stock_plot_desc_output"] = stock_plot_desc_output