Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from datetime import date,timedelta
|
|
| 6 |
pn.extension('bokeh', template='bootstrap')
|
| 7 |
import hvplot.pandas
|
| 8 |
|
| 9 |
-
|
| 10 |
def get_df(todaydate):
|
| 11 |
todaydate2 = datetime.today().strftime("%Y-%m-%d")
|
| 12 |
# todaydate2 =todaydate.strftime("%Y-%m-%d")
|
|
@@ -35,9 +35,9 @@ def create_plot(selectedcol,selecteditem,todaydate):
|
|
| 35 |
group_means = df.groupby(selecteditem)[selectedcol].mean()
|
| 36 |
df2 = df.merge(group_means, left_on=selecteditem, right_index=True, suffixes=('', f'_{selecteditem}_mean'))
|
| 37 |
|
| 38 |
-
return df2.hvplot.bar(x=selecteditem, y=f'{selectedcol}_{selecteditem}_mean', hover_cols=selectedhover, height=
|
| 39 |
|
| 40 |
bound_plot = pn.bind(create_plot, selectedcol=selectedcol , selecteditem=selecteditem, todaydate=todaydate)
|
| 41 |
-
pn.Column(selectedcol, selecteditem, todaydate, bound_plot).servable(title="Financial Sector Ratios Navigator")
|
| 42 |
|
| 43 |
|
|
|
|
| 6 |
pn.extension('bokeh', template='bootstrap')
|
| 7 |
import hvplot.pandas
|
| 8 |
|
| 9 |
+
@pn.cache
|
| 10 |
def get_df(todaydate):
|
| 11 |
todaydate2 = datetime.today().strftime("%Y-%m-%d")
|
| 12 |
# todaydate2 =todaydate.strftime("%Y-%m-%d")
|
|
|
|
| 35 |
group_means = df.groupby(selecteditem)[selectedcol].mean()
|
| 36 |
df2 = df.merge(group_means, left_on=selecteditem, right_index=True, suffixes=('', f'_{selecteditem}_mean'))
|
| 37 |
|
| 38 |
+
return df2.hvplot.bar(x=selecteditem, y=f'{selectedcol}_{selecteditem}_mean', hover_cols=selectedhover, height=800, width=1800).opts(xrotation=90, fontsize={'xticks': 10})
|
| 39 |
|
| 40 |
bound_plot = pn.bind(create_plot, selectedcol=selectedcol , selecteditem=selecteditem, todaydate=todaydate)
|
| 41 |
+
pn.Column(pn.Row(selectedcol, selecteditem, todaydate), bound_plot).servable(title="Financial Sector Ratios Navigator")
|
| 42 |
|
| 43 |
|