0

I'm getting NaN values when I substract truth values from forecasted values. I can't see why this will not work. Here is my code and the output below that. The output shows that the values cannot be subtracted, but I can't figure out why.

mte_forecast = pred.predicted_mean
print(mte_forecast)

mte_truth = mte.loc['2003-07-01':]
print(mte_truth)


# Compute the mean square error
mse = ((mte_forecast - mte_truth) ** 2).mean()
print(mse)

Here is the output I get:
2003-07-01    33.152466
2003-08-01    35.986610
2003-09-01    28.641228
2003-10-01    21.268629
2003-11-01    17.953365
                ...    
2016-03-01    39.184456
2016-04-01    39.275757
2016-05-01    43.132015
2016-06-01    49.973976
2016-07-01    61.067493
Freq: MS, Name: predicted_mean, Length: 157, dtype: float32
            emissions
dates                
2003-07-01  34.139999
2003-08-01  37.020000
2003-09-01  25.382000
2003-10-01  22.150000
2003-11-01  18.858000
...               ...
2016-03-01  40.525002
2016-04-01  39.763000
2016-05-01  44.209999
2016-06-01  53.567001
2016-07-01  62.881001

[157 rows x 1 columns]
2003-07-01 00:00:00   NaN
2003-08-01 00:00:00   NaN
2003-09-01 00:00:00   NaN
2003-10-01 00:00:00   NaN
2003-11-01 00:00:00   NaN
                       ..
2016-04-01 00:00:00   NaN
2016-05-01 00:00:00   NaN
2016-06-01 00:00:00   NaN
2016-07-01 00:00:00   NaN
emissions             NaN
Length: 158, dtype: float64
Viv
  • 1
  • Possibly I didn't provide enough information: This is for my time-series SARIMA model and I received an error message that looked like this: "Addition/subtraction of integers and integer-arrays with Timestamp is no longer supported. Instead of adding/subtracting `n`, use `n * obj.freq`" – Viv Jan 24 '22 at 16:13
  • There are 3 sections to the output: – Viv Jan 24 '22 at 16:14
  • The 3 sections are: Section 1) mte_forecast; Section 2) mte_truth; Section 3) mse – Viv Jan 24 '22 at 16:25
  • Can you please provice the data types of `mte_truth` and `mte_forecast`, you can get that with `type(mte_truth)` – Arne Decker Jan 25 '22 at 09:15

0 Answers0