Chitranshu commited on
Commit
cb08102
1 Parent(s): c45f442

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -78,12 +78,15 @@ total_rides_graph = df_total_rides.hvplot.bar(x='Days', y='Rides', color='black'
78
  # Your original data processing
79
  weekly_data = weekly_data.groupby(['Day', 'Time']).mean('Rides')
80
  weekly_data1 = weekly_data.unstack(level=0)
 
81
 
82
- # Create a Panel object
83
- avg_rides_graph = pn.panel(weekly_data1.T.mean().hvplot(c='black', xlabel='Date', ylabel='Average rides',
84
- xticks=10, title='Average Uber rides on any day in July 2014 at NYC',
85
- height=400, width=800))
86
 
 
 
87
  # --- Code 5 ---
88
  # Countplot using hvplot
89
  BaseMapper = {'B02512': 'Unter', 'B02598': 'Hinter', 'B02617': 'Weiter', 'B02682': 'Schmecken', 'B02764': 'Danach-NY'}
@@ -159,7 +162,7 @@ def update_chart(event):
159
  elif event.new == 'Total Rides per Day':
160
  panel_layout[1] = total_rides_graph
161
  elif event.new == 'Avg Rides per Day':
162
- panel_layout[1] = avg_rides_graph
163
  elif event.new == 'Top Rides City':
164
  panel_layout[1] = plot_top_rides_city
165
  elif event.new == 'Predicting Distance':
 
78
  # Your original data processing
79
  weekly_data = weekly_data.groupby(['Day', 'Time']).mean('Rides')
80
  weekly_data1 = weekly_data.unstack(level=0)
81
+ average_rides = weekly_data1.T.mean()
82
 
83
+ # Create a HoloViews plot
84
+ rides_plot = average_rides.hvplot(c='black', xlabel='Date', ylabel='Average rides',
85
+ xticks=10, title='Average Uber rides on any day in July 2014 at NYC',
86
+ height=400, width=800)
87
 
88
+ # Wrap the plot in a Panel
89
+ avg_rides_panel = pn.panel(rides_plot)
90
  # --- Code 5 ---
91
  # Countplot using hvplot
92
  BaseMapper = {'B02512': 'Unter', 'B02598': 'Hinter', 'B02617': 'Weiter', 'B02682': 'Schmecken', 'B02764': 'Danach-NY'}
 
162
  elif event.new == 'Total Rides per Day':
163
  panel_layout[1] = total_rides_graph
164
  elif event.new == 'Avg Rides per Day':
165
+ panel_layout[1] = avg_rides_panel
166
  elif event.new == 'Top Rides City':
167
  panel_layout[1] = plot_top_rides_city
168
  elif event.new == 'Predicting Distance':