Spyro1322 / BasketDataHub

Repository for analyzing and reporting basketball data
1 stars 0 forks source link

Create function for each functionality you have #4

Open kapsali29 opened 4 years ago

kapsali29 commented 4 years ago

For example check that functionality that creates the diagram for "Top 20 scorers from 2004"

https://github.com/Spyro1322/BasketDataHub/blob/main/DataVisualization/BasicSteps.py#L43

Create function for that functionality and for other functionalities you have for having code reusability

kapsali29 commented 4 years ago

For example

def top_20_scorers(player_name):
    top_scorers = games_details.groupby(by=player_name')['PTS'].sum().sort_values(ascending =False).head(20).reset_index()
    plt.figure(figsize=(15,10))
    plt.xlabel('POINTS',fontsize=15)
    plt.ylabel('PLAYER_NAME',fontsize=15)
    plt.title('Top 20 Scorers in the NBA League',fontsize = 20)
    ax = sns.barplot(x=top_scorers['PTS'],y = top_scorers['PLAYER_NAME'])
    for i ,(value,name) in enumerate (zip(top_scorers['PTS'],top_scorers['PLAYER_NAME'])):
       ax.text(value, i-.05,f'{value:,.0f}',size = 10,ha='left',va='center')
       ax.set(xlabel='POINTS',ylabel='PLAYER_NAME')
   plt.show()
Spyro1322 commented 4 years ago

To be done during the day plus some more ideas I hope they will work. Thank you for your advice. In the evening I am going to send you a more detailed mail about what I have done till now and what I am thinking about next week. Any feedback would be really helpful.

kapsali29 commented 4 years ago

Close the issue when the requested functionalities are done