Surya152002 commited on
Commit
0063565
·
1 Parent(s): 2fc133a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -71,17 +71,18 @@ if len(data_close) >= look_back:
71
  # Plot the results using Plotly
72
  fig = go.Figure()
73
  fig.add_trace(go.Scatter(x=data.index, y=data['Close'], mode='lines+markers', name='Close Price'))
 
 
 
 
 
 
74
  # Add predicted prices to the plot
75
- prediction_dates = pd.date_range(start=data.index[-1], periods=prediction_days+1, closed='right')
76
  fig.add_trace(go.Scatter(x=prediction_dates, y=predictions_list, mode='lines+markers', name='Predicted Price', marker=dict(color='red')))
77
  fig.update_layout(title='Cryptocurrency Price Prediction', xaxis_title='Date', yaxis_title='Price', legend_title='Legend')
78
  st.plotly_chart(fig, use_container_width=True)
79
 
80
-
81
-
82
-
83
  # Display download link for predictions with actual prices included
84
- prediction_dates = pd.date_range(start=data.index[-1], periods=prediction_days+1, closed='right')
85
  prediction_df = pd.DataFrame(index=prediction_dates)
86
  prediction_df['Predicted Price'] = predictions_list
87
  prediction_df['Actual Price'] = data['Close'][-prediction_days:].values
 
71
  # Plot the results using Plotly
72
  fig = go.Figure()
73
  fig.add_trace(go.Scatter(x=data.index, y=data['Close'], mode='lines+markers', name='Close Price'))
74
+
75
+ # Generate prediction dates without using the 'closed' parameter
76
+ last_date = data.index[-1]
77
+ prediction_dates = pd.date_range(start=last_date, periods=prediction_days+1)[1:]
78
+ # The [1:] slice is used to exclude the starting date and effectively achieve 'closed=right'
79
+
80
  # Add predicted prices to the plot
 
81
  fig.add_trace(go.Scatter(x=prediction_dates, y=predictions_list, mode='lines+markers', name='Predicted Price', marker=dict(color='red')))
82
  fig.update_layout(title='Cryptocurrency Price Prediction', xaxis_title='Date', yaxis_title='Price', legend_title='Legend')
83
  st.plotly_chart(fig, use_container_width=True)
84
 
 
 
 
85
  # Display download link for predictions with actual prices included
 
86
  prediction_df = pd.DataFrame(index=prediction_dates)
87
  prediction_df['Predicted Price'] = predictions_list
88
  prediction_df['Actual Price'] = data['Close'][-prediction_days:].values