def team_avg(username, platform): df = {} for i in range(len(username)): time.sleep(1) df['df{}'.format(i)] = weekly_stats(username[i], platform[i]) text1 = df['df0'].columns[0] text2 = df['df0'].columns[1] text3 = df['df0'].columns[2] text4 = df['df0'].columns[3] matches = int(df['df0'][df['df0'].columns[0]]) for i in range(len(df)): matches += int(df['df{}'.format(i)][df['df{}'.format(i)].columns[0]]) avg_matches = matches / len(df) dmgDone = int(df['df0'][df['df0'].columns[1]]) for i in range(len(df)): dmgDone += int(df['df{}'.format(i)][df['df{}'.format(i)].columns[1]]) avg_dmgDone = dmgDone / len(df) dmgTaken = int(df['df0'][df['df0'].columns[2]]) for i in range(len(df)): dmgTaken += int(df['df{}'.format(i)][df['df{}'.format(i)].columns[2]]) avg_dmgTaken = dmgTaken / len(df) kd = int(df['df0'][df['df0'].columns[3]]) for i in range(len(df)): kd += int(df['df{}'.format(i)][df['df{}'.format(i)].columns[3]]) avg_kd = round(kd / len(df), 2) return (text1, text2, text3, text4, avg_matches, avg_dmgDone, avg_dmgTaken, avg_kd)
def update_card_text_4(n_clicks, dropdown_value, range_slider_value, check_list_value, radio_items_value): print(n_clicks) print(dropdown_value) print(range_slider_value) print(check_list_value) print(radio_items_value) # Sample data and figure df = weekly_stats('iBHuynhing', 'psn') return float(df[df.columns[3]])