Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,13 @@ def get_df(todaydate):
|
|
| 19 |
|
| 20 |
return df
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
selectedcol = pn.widgets.Select(name='Select Ratio', value = 'PEG Ratio', options=list(df.columns))
|
| 23 |
selecteditem = pn.widgets.Select(name='Select Item', options=['Industry' , 'Sector'])
|
| 24 |
|
|
@@ -33,14 +40,7 @@ def create_plot(selectedcol,selecteditem,todaydate):
|
|
| 33 |
|
| 34 |
return df2.hvplot.bar(x=selecteditem, y=f'{selectedcol}_{selecteditem}_mean', hover_cols=selectedhover, height=600, width=1600).opts(xrotation=90, fontsize={'xticks': 10})
|
| 35 |
|
| 36 |
-
|
| 37 |
-
todaydate = pn.widgets.DatePicker(
|
| 38 |
-
name ="End Date",# value=datetime(2000, 1, 1),
|
| 39 |
-
description='Select a Date',
|
| 40 |
-
end= date.today() #date(2023, 9, 1)
|
| 41 |
-
)
|
| 42 |
-
|
| 43 |
-
|
| 44 |
bound_plot = pn.bind(create_plot, selectedcol=selectedcol , selecteditem=selecteditem, todaydate=todaydate)
|
| 45 |
pn.Column(selectedcol, selecteditem, todaydate, bound_plot)
|
| 46 |
|
|
|
|
|
|
| 19 |
|
| 20 |
return df
|
| 21 |
|
| 22 |
+
todaydate = pn.widgets.DatePicker(
|
| 23 |
+
name ="End Date",# value=datetime(2000, 1, 1),
|
| 24 |
+
description='Select a Date',
|
| 25 |
+
end= date.today() #date(2023, 9, 1)
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
df = get_df(todaydate)
|
| 29 |
selectedcol = pn.widgets.Select(name='Select Ratio', value = 'PEG Ratio', options=list(df.columns))
|
| 30 |
selecteditem = pn.widgets.Select(name='Select Item', options=['Industry' , 'Sector'])
|
| 31 |
|
|
|
|
| 40 |
|
| 41 |
return df2.hvplot.bar(x=selecteditem, y=f'{selectedcol}_{selecteditem}_mean', hover_cols=selectedhover, height=600, width=1600).opts(xrotation=90, fontsize={'xticks': 10})
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
bound_plot = pn.bind(create_plot, selectedcol=selectedcol , selecteditem=selecteditem, todaydate=todaydate)
|
| 44 |
pn.Column(selectedcol, selecteditem, todaydate, bound_plot)
|
| 45 |
|
| 46 |
+
|