title: negative forcasts using facebook prophet
body: <p>I  have a daily time series  data  for   almost 2 years   for cluster  available space (in GB). I  am trying to   to use  facebook's prophet to do future forecasts. Some forecasts  have   negative values. Since   negative values  does not make   sense I saw that  using carrying capacity   for logistic growth model   helps   in  eliminating negative  forecasts  with  cap   values. I am not sure   if this   is applicable for this case and how  to get the  cap value    for my time series. Please help  as I am new to this  and  confused. I am  using Python 3.6</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  import xlrd
  import openpyxl
  from pandas import datetime
  import csv
  import matplotlib.pyplot as plt
  plt.style.use('fivethirtyeight')
  from fbprophet import Prophet
  import os
  import sys
  import signal
  
  
  
  
  df = pd.read_excel("Data_Per_day.xlsx")
  df1=df.filter(['cluster_guid','date','avail_capacity'],axis=1)
  uniquevalues = np.unique(df1[['cluster_guid']].values)
  
  for id in uniquevalues:
  
  
  newdf = df1[df1['cluster_guid'] == id]
  
      newdf1=newdf.groupby(['cluster_guid','date'],as_index=False['avail_capacity'].sum()
          #newdf11=newdf.groupby(['cluster_guid','date'],as_index=False)['total_capacity'].sum()
          #cap[id]=newdf11['total_capacity'].max()
          #print(cap[id])
      newdf1.set_index('cluster_guid', inplace=True)
  
      newdf1.to_csv('my_csv.csv', mode='a',header=None)
  with open('my_csv.csv',newline='') as f:
      r = csv.reader(f)
      data = [line for line in r]
  with open('my_csv.csv','w',newline='') as f:
      w = csv.writer(f)
      w.writerow(['cluster_guid','DATE_TAKEN','avail_capacity'])
      w.writerows(data)
  
  
  
  
  
  in_df = pd.read_csv('my_csv.csv', parse_dates=True, index_col='DATE_TAKEN' )
  
  in_df.to_csv('my_csv.csv')
  
  dfs= pd.read_csv('my_csv.csv')
  uni=dfs.cluster_guid.unique()
  
  while True:
      try:
          print(" Press Ctrl +C  to exit   or  enter the cluster guid to be forcasted")
          i=input('Please enter the cluster  guid')
          if i not in uni:
              print( 'Please  enter a  valid cluster  guid')
              continue
          else:
  
          dfs1=dfs.loc[df['cluster_guid'] == i]
          dfs1.drop('cluster_guid', axis=1, inplace=True)
          dfs1.to_csv('dataframe'+i+'.csv', index=False)
          dfs2=pd.read_csv('dataframe'+i+'.csv')
          dfs2['DATE_TAKEN'] = pd.DatetimeIndex(dfs2['DATE_TAKEN'])
          dfs2 = dfs2.rename(columns={'DATE_TAKEN': 'ds','avail_capacity': 'y'})
          my_model = Prophet(interval_width=0.99)
          my_model.fit(dfs2)
          future_dates = my_model.make_future_dataframe(periods=30, freq='D')
          forecast = my_model.predict(future_dates)
          print(forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']])
          my_model.plot(forecast,uncertainty=True)
          my_model.plot_components(forecast)
          plt.show()
  
          os.remove('dataframe'+i+'.csv')
          os.remove('my_csv.csv')
  
  
  except KeyboardInterrupt: 
      try:
          os.remove('my_csv.csv')
      except OSError:
          pass
      sys.exit(0)
  </code></pre>