Last active
February 20, 2020 06:33
-
-
Save databyjp/6020d517ff36b6a2e9f686412a5ecda2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def add_fan_pts(in_df): | |
in_df = in_df.assign( | |
fan_pts=( | |
(in_df.points_scored + | |
(in_df.offensive_rebounds + in_df.defensive_rebounds) * 1.2 + | |
in_df.assists * 1.5 + in_df['blocks'] * 2 + in_df.steals * 2 - in_df.turnovers) | |
) | |
) | |
return in_df | |
temp_df_list = list() | |
temp_slugs = season_tot_df[season_tot_df['name'].isin(['Eric Bledsoe', 'Khris Middleton'])].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]) | |
temp_df_list.append(temp_df) | |
comp_df = pd.concat(temp_df_list, axis=0) | |
comp_df.reset_index(inplace=True, drop=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment