I have a data set which has video games, their sales, and the year the game was released. I am only looking for the game sales per year, not the game sales per title per year.
I am using a pandas Dataframe. I have tried a groupby method. I have tried a loop with .unique() values.
df = df[["Year", "NA_Sales"]]
df.Year = df.Year.astype(int)
df2 = df
df2.Year = df.Year.unique()
df2 = df.groupby(['Year'])['NA_Sales'].sum()
The expected result would be a dataframe including one column of unique year values, and one column of all video game sales for that year
df.groupby(['Year'])['NA_Sales'].sum().reset_index()?