I would like to make the following table:
I wrote this code to group by year to get the Mean price per year. However, I am having trouble adding the
Houses Sold column into the grouped dataframe. The
Houses Sold column is the value_counts of the Years. How can I do this? Thank you in advance.
houses_year = houses[['Yr Sold','SalePrice']] grouped_year = houses_year.groupby(['Yr Sold']) grouped_sales_year = grouped_year['SalePrice'] houses_year = grouped_sales_year.mean()