Skip to content

Instantly share code, notes, and snippets.

@databyjp
Created February 20, 2020 08:10
Show Gist options
  • Save databyjp/03e73449748792eac245fbab13928bde to your computer and use it in GitHub Desktop.
Save databyjp/03e73449748792eac245fbab13928bde to your computer and use it in GitHub Desktop.
top_pl_df_list = list()
temp_slugs = season_tot_df[(season_tot_df.fan_ppg > 30) & (season_tot_df.fan_ppg < 40)].slug.unique()
for pl_slug in temp_slugs:
temp_df = pd.DataFrame(pl_data_dict[pl_slug])
temp_df = add_fan_pts(temp_df)
temp_df = temp_df.assign(player=season_tot_df[season_tot_df.slug == pl_slug]['name'].values[0])
top_pl_df_list.append(temp_df)
top_pl_df = pd.concat(top_pl_df_list, axis=0)
top_pl_df.reset_index(inplace=True, drop=True)
# Box plot
fig = px.box(top_pl_df, x='player', y='fan_pts', labels={'fan_pts': 'Fantasy Points', 'date': 'Date'})
clean_chart_format(fig, namelocs=[0.9, 0.9])
fig.update_layout(title='Fantasy performance comparison - top players', font=dict(size=10))
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment