selecting the row with given datetime index

Tags: , ,



There are 2 datasets I wanna use to find the evaluation score which data_pred , data_test

First of all, the data_test is the data that is used to check the accuracy which looks like this

data_test

the data_pred is got from ARIMA prediction which looks ‚Äčlike this

enter image description here

The reason I can’t find the MSE score between these 2 datasets is that the number of rows is not equal, since the data_pred predicted every single by the range of the starting date to the end date of the test set.

So, My question is how to select the data_pred instance which has the same index as data_test

P.s. date is the index of both dataset

Answer

try:

df2.set_index('date').subtract(df.set_index('date')).dropna().pow(2).sum().values[0]

enter image description here



Source: stackoverflow