0

I'm trying to use AWS Amazon Forecast but am running into an error when I'm running the Amazon Forecast Quickstart guide.

This is the code:

results_df = pd.DataFrame(columns=['timestamp', 'value', 'source'])


for index, row in actuals.iterrows():
    clean_timestamp = dateutil.parser.parse(row['timestamp'])
    results_df = results_df.append({'timestamp' : clean_timestamp , 'value' : row['target_value'], 'source': 'actual'} , ignore_index=True)
for index, row in forecasts_p10_df.iterrows():
    clean_timestamp = dateutil.parser.parse(row['Timestamp'])
    results_df = results_df.append({'timestamp' : clean_timestamp , 'value' : row['Value'], 'source': 'p10'} , ignore_index=True)
for index, row in forecasts_p50_df.iterrows():
    clean_timestamp = dateutil.parser.parse(row['Timestamp'])
    results_df = results_df.append({'timestamp' : clean_timestamp , 'value' : row['Value'], 'source': 'p50'} , ignore_index=True)
for index, row in forecasts_p90_df.iterrows():
    clean_timestamp = dateutil.parser.parse(row['Timestamp'])
    results_df = results_df.append({'timestamp' : clean_timestamp , 'value' : row['Value'], 'source': 'p90'} , ignore_index=True)

pivot_df = results_df.pivot(columns='source', values='value', index="timestamp")

pivot_df.plot(figsize=(15, 7))

I'm getting this error:

AttributeError: 'DataFrame' object has no attribute 'append'

I'm new to this so can someone please help me fix this problem?

I tried running the code but it wasn't working and an error was popping up, I don't know how to fix it.

  • I don't think this is related to python, have you checked https://stackoverflow.com/questions/75956209/dataframe-object-has-no-attribute-append ? It looks like the append was removed in later version of pandas, maybe the quickstart guide is outdated because it was using older version of pandas. – Alexandre_Bon Aug 03 '23 at 10:17

0 Answers0