Column in scatter



  • There's a date with play sales. I have to make a precise schedule (scatter) for all players a year. But since there's a different number of players in the games one year, there's something like that. введите сюда описание изображения

    I can't figure out how to sum up all players in one year.

    plt.style.use('seaborn')
    x=games_sales_df['Year_of_Release']
    y=games_sales_df['User_Count']
    plt.scatter(x,y,c='green', edgecolor='black')
    plt.xlabel('Год')
    plt.ylabel('Количество игроков')
    

    I thought I'd do something like,

    plt.scatter(x,games_sales_df['Year_of_Release']['User_Count'].sum(),c='green', edgecolor='black')
    

    But it would be too easy. Help me, please!



  • You should have just grouped up:

    graph = games_sales_df[["Year_of_Release", "User_Count"]].groupby("Year_of_Release").sum().reset_index()
    plt.style.use('seaborn')
    x=graph['Year_of_Release']
    y=graph['User_Count']
    plt.scatter(x,y,c='green', edgecolor='black')
    plt.xlabel('Год')
    plt.ylabel('Количество игроков')
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2