madsryfeldt commited on
Commit
b3733ec
1 Parent(s): de53317

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -33,11 +33,11 @@ st.write(filtered_df)
33
  avg_prices = filtered_df.groupby(['neighbourhood', 'room_type'])['price'].mean().reset_index()
34
 
35
  # Pivot the DataFrame to have neighbourhoods as index and room types as columns
36
- avg_prices_pivot = avg_prices.pivot(index='neighbourhood', values='price')
37
 
38
- # Plot a histogram for each neighbourhood
39
  if not avg_prices_pivot.empty:
40
- st.write('Histogram of Average Price for Each Neighbourhood:')
41
  fig, ax = plt.subplots()
42
  avg_prices_pivot.plot(kind='bar', ax=ax)
43
  ax.set_xlabel('Neighbourhood')
 
33
  avg_prices = filtered_df.groupby(['neighbourhood', 'room_type'])['price'].mean().reset_index()
34
 
35
  # Pivot the DataFrame to have neighbourhoods as index and room types as columns
36
+ avg_prices_pivot = avg_prices.pivot(index='neighbourhood', columns='room_type', values='price')
37
 
38
+ # Plot a bar chart for average price of both room types in each neighbourhood
39
  if not avg_prices_pivot.empty:
40
+ st.write('Bar Chart of Average Price for Each Neighbourhood and Room Type:')
41
  fig, ax = plt.subplots()
42
  avg_prices_pivot.plot(kind='bar', ax=ax)
43
  ax.set_xlabel('Neighbourhood')