Diego Marroquin commited on
Commit ·
30d1d68
1
Parent(s): 25fa3a9
added real forecast
Browse files
app.py
CHANGED
|
@@ -16,6 +16,7 @@ import matplotlib.pyplot as plt
|
|
| 16 |
from matplotlib.dates import MonthLocator
|
| 17 |
|
| 18 |
|
|
|
|
| 19 |
def mongo_unavs_call(user_input_start_date, user_input_end_date, user_input_past_date):
|
| 20 |
print("Starting mongo_unavs_call")
|
| 21 |
# Connect to the MongoDB database
|
|
@@ -633,10 +634,20 @@ def run_app():
|
|
| 633 |
|
| 634 |
st.write("Previous forecast")
|
| 635 |
st.line_chart(df_photo_date_2)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
# Combine dataframes
|
| 638 |
-
combined_df = pd.concat([df_nucmonitor_2, df_photo_date_2], axis=1)
|
| 639 |
-
combined_df.columns = [f'Forecast {current_date_str}', f'Forecast {past_date_str}']
|
| 640 |
|
| 641 |
print(combined_df)
|
| 642 |
st.write(f"Graph 1. {start_date} to {end_date}")
|
|
@@ -660,6 +671,8 @@ def run_app():
|
|
| 660 |
|
| 661 |
st.pyplot(fig)
|
| 662 |
|
|
|
|
|
|
|
| 663 |
|
| 664 |
# Add a download button
|
| 665 |
# Create a BytesIO object to hold the Excel data
|
|
|
|
| 16 |
from matplotlib.dates import MonthLocator
|
| 17 |
|
| 18 |
|
| 19 |
+
|
| 20 |
def mongo_unavs_call(user_input_start_date, user_input_end_date, user_input_past_date):
|
| 21 |
print("Starting mongo_unavs_call")
|
| 22 |
# Connect to the MongoDB database
|
|
|
|
| 634 |
|
| 635 |
st.write("Previous forecast")
|
| 636 |
st.line_chart(df_photo_date_2)
|
| 637 |
+
# Create a new dataframe out of df_nucmonitor_2 call real_forecast that contains df_nucmonitor_2 up until current_date
|
| 638 |
+
|
| 639 |
+
# Slice the DataFrame to include data up until current_date
|
| 640 |
+
real_forecast = df_nucmonitor_2.loc[df_nucmonitor_2.index <= current_date_str]
|
| 641 |
|
| 642 |
+
# Optionally, if you want to reset the index
|
| 643 |
+
# real_forecast = real_forecast.reset_index()
|
| 644 |
+
print(real_forecast)
|
| 645 |
+
st.write("Real forecast")
|
| 646 |
+
st.line_chart(real_forecast)
|
| 647 |
+
|
| 648 |
# Combine dataframes
|
| 649 |
+
combined_df = pd.concat([df_nucmonitor_2, df_photo_date_2, real_forecast], axis=1)
|
| 650 |
+
combined_df.columns = [f'Forecast {current_date_str}', f'Forecast {past_date_str}', 'Real Forecast']
|
| 651 |
|
| 652 |
print(combined_df)
|
| 653 |
st.write(f"Graph 1. {start_date} to {end_date}")
|
|
|
|
| 671 |
|
| 672 |
st.pyplot(fig)
|
| 673 |
|
| 674 |
+
# For Historical Winter Availability, can just get the max and min of each month, store as list in a column, and try to graph that
|
| 675 |
+
|
| 676 |
|
| 677 |
# Add a download button
|
| 678 |
# Create a BytesIO object to hold the Excel data
|