KeyError:运行python代码时出现“ condition_name”

时间:2019-12-09 18:47:39

标签: python tensorflow machine-learning flask deep-learning

我是编码新手。我知道所有的天才都在这里。 我正在尝试从git hub运行python数据科学项目。 这是指向github的链接:https://github.com/Sparxxz/Flood-Rainfall-Disaster-Prediction-Website 我收到此错误 KeyError:“ condition_name”

Traceback (most recent call last):
File "/home/walia/.local/lib/python3.6/site-packages/flask/app.py", line 2463, in __call__
    return self.wsgi_app(environ, start_response)
File "/home/walia/.local/lib/python3.6/site-packages/flask/app.py", line 2449, in wsgi_app
    response = self.handle_exception(e)
File "/home/walia/.local/lib/python3.6/site-packages/flask/app.py", line 1866, in handle_exception
    reraise(exc_type, exc_value, tb)
File "/home/walia/.local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
File "/home/walia/.local/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
File "/home/walia/.local/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
File "/home/walia/.local/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
File "/home/walia/.local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
File "/home/walia/.local/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
File "/home/walia/.local/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
File "/home/walia/Flood-Rainfall-Disaster-Prediction-Website/sourceCode/main.py", line 64, in floodResult
    results_dict=driver.drive(river,user_date)
File "/home/walia/Flood-Rainfall-Disaster-Prediction-Website/sourceCode/driver.py", line 94, in drive
    d1=dp.discharge_forecast(filename,wtd)
File "/home/walia/Flood-Rainfall-Disaster-Prediction-Website/sourceCode/discharge_prophet.py", line 163, in discharge_forecast
    df4,df2_forecast=predicting_data(wtd)
File "/home/walia/Flood-Rainfall-Disaster-Prediction-Website/sourceCode/discharge_prophet.py", line 155, in predicting_data
    df2_forecast = df2_prophet.predict(df2_forecast)
File "/home/walia/.local/lib/python3.6/site-packages/fbprophet/forecaster.py", line 1172, in predict
    df = self.setup_dataframe(df.copy())
File "/home/walia/.local/lib/python3.6/site-packages/fbprophet/forecaster.py", line 257, in setup_dataframe
    condition_name = props['condition_name']
KeyError: 'condition_name'

这是我的预测数据功能

def predicting_data(i=1):
    if i==0:
        #For testing 
        # Make a future dataframe for (2 Years)
        df2_forecast = df2_prophet.make_future_dataframe(periods=30*25 , freq='D')
        # Make predictions
        df2_forecast = df2_prophet.predict(df2_forecast)
        df3=df2_forecast[['ds','yhat']]
        df3.shape,df1.shape,df2.shape
        df4=df3.iloc[6940:-20,:]

    else:
        #For Future prediction of 2019
        # Make a future dataframe for 12 months
        df2_forecast = df2_prophet.make_future_dataframe(periods=30*12 , freq='D',include_history=False)
        # Make predictions
        df2_forecast = df2_prophet.predict(df2_forecast)
        df3=df2_forecast[['ds','yhat']]
        #df3.shape,df1.shape,df2.shape
        df4=df3.iloc[:,:]
    return df4,df2_forecast

请帮助。

0 个答案:

没有答案