Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import datetime
  2. # Plotting data
  3. df.dropna(inplace=True)
  4. df['forecast'] = np.nan
  5. last_date = df.iloc[-1].name
  6. last_unix = last_date.timestamp()
  7. one_day = 86400
  8. next_unix = last_unix + one_day
  9.  
  10. for i in forecast_prediction:
  11. next_date = datetime.datetime.fromtimestamp(next_unix)
  12. next_unix += 86400
  13. df.loc[next_date] = [np.nan for _ in range(len(df.columns)-1)]+[i]
  14. df['close'].plot(figsize=(15,6), color="green")
  15. df['forecast'].plot(figsize=(15,6), color="orange")
  16. plt.legend(loc=4)
  17. plt.xlabel('Date')
  18. plt.ylabel('Price')
  19. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement