<jupyter_start><jupyter_text>Players by Points Per Game<jupyter_code>seasons.sort_values(by='PPG', ascending=False)[['Year', 'Player', 'PPG']]
def get_top_players(agg_func, by = 'PPG'):
    return seasons.groupby('Player', as_index=False) \
                .agg(agg_func) \
                .sort_values(by=by, ascending=False) \
                .head(10)[['Player', by]]
top_players_ppg_mean = get_top_players(np.mean)
top_players_ppg_sum = get_top_players(np.sum, by='PTS')<jupyter_output><empty_output><jupyter_text>Top players by mean value of Points Per Game<jupyter_code>top_players_ppg_mean<jupyter_output><empty_output><jupyter_text>Players who score the most points during the whole career<jupyter_code>top_players_ppg_sum<jupyter_output><empty_output><jupyter_text>Teams with the most points<jupyter_code>d = seasons.groupby('Tm', as_index=False) \
    .agg(np.sum) \
    .sort_values(by='PTS', ascending=False) \
    .head(20)
sns.barplot(data=d, x='Tm', y='PTS')
seasons['PTSpm'] = seasons['PTS'] / seasons['MP']
seasons['ASTpm'] = seasons['AST'] / seasons['MP']
seasons['TRBpm'] = seasons['TRB'] / seasons['MP']<jupyter_output><empty_output><jupyter_text>Stats (points - PTS; assists - AST; rebounds - TRB) by age<jupyter_code># normalized by minutes played
seasons.groupby('Age') \
    .agg(np.mean)[['PTSpm', 'ASTpm', 'TRBpm']] \
    .plot()
    
# not normalized
seasons.groupby('Age') \
    .agg(np.mean)[['PTS', 'AST', 'TRB']] \
    .plot()<jupyter_output><empty_output><jupyter_text>Minutes played by age<jupyter_code>seasons.groupby('Age').agg(np.mean)[['MP']].plot()
# same as above but with regression curve instead of a mean
sns.lmplot(x='Age', y='MP', data=seasons, lowess=True)
plt.figure(figsize=(15,15))
plt.plot(seasons.Year,seasons.PPG,'o', alpha = 0.1, color='#00736A')
plt.plot(seasons.Year[seasons.Player == '<NAME>'],seasons.PPG[seasons.Player == '<NAME>'], color = '#FF5A00')
plt.plot(seasons.Year[seasons.Player == '<NAME>*'],seasons.PPG[seasons.Player == '<NAME>*'], color = 'r')
plt.plot(seasons.Year[seasons.Player == 'Wilt Chamberlain*'],seasons.PPG[seasons.Player == 'Wilt Chamberlain*'])
plt.legend(['All','<NAME>','<NAME>','Wilt Chamberlain*'], fontsize = 15)
plt.xlabel('Year')
plt.ylabel('Points Per Game')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18867924528301888, 'fraction_numerical': 0.008775778850372971, 'mean_word_length': 6.147335423197492, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '414875', 'license': 'MIT', 'n_tokens_mistral': 914, 'n_tokens_neox': 874, 'n_words': 134, 'path': '2017-09-13-MeetIT-Torun/NBA.ipynb', 'repo_name': 'wikp/peaches', 'size': '2318'}