Created
February 21, 2020 01:38
-
-
Save databyjp/278402bf3640ee9b0f43be599c92c6d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
top_pl_df_list = list() | |
temp_slugs = season_tot_df[(season_tot_df.fan_ppg > 35) & (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 - 35-40 Points/game', font=dict(size=10)) | |
fig.show() | |
# Histogram plot | |
fig = px.histogram(top_pl_df, x='fan_pts', facet_col='player', facet_col_wrap=3, | |
labels={'fan_pts': 'Fantasy Points', 'date': 'Date'}, hover_name='player') | |
clean_chart_format(fig, namelocs=[0.9, 0.95]) | |
fig.update_layout(title='Fantasy performance comparison - 35-40 Points/game', font=dict(size=10)) | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment