I have a data frame that is grouped by two columns: "year" and "neighborhood" . I want to be able to sale prices per sq foot and gross rent as line charts and be able to toggle between neighborhoods. At the moment the widget is rendered but as I toggle between neighborhoods the data stays the same. Any thoughts on why this might not be working?
# Group by year and neighborhood and then create a new dataframe of the mean values
prices_by_year_by_neighborhood = sfo_data_df.groupby(by=['year','neighborhood']).mean()
# Review the DataFrame
prices_by_year_by_neighborhood.head()
[screenshot1](https://i.stack.imgur.com/FAths.png)
# Filter out the housing_units
prices_by_year_by_neighborhood = prices_by_year_by_neighborhood.drop(columns=['housing_units'])
# Review the first and last five rows of the DataFrame
display(prices_by_year_by_neighborhood.head())
display(prices_by_year_by_neighborhood.tail())
# Use hvplot to create an interactive line plot of the average price per square foot
prices_by_year_by_neighborhood.hvplot.line(
x="year",
y=["sale_price_sqr_foot", "gross_rent"],
groupby="neighborhood",
title="Price per square foot and average gross rent 2010 to 2016 in SF per Neighborhood"
)
I have tried to make sure the naming of the columns is correct and also double checked the parameters for the hvplot line graph.