Error using Predict: "The data being evaluated is not formatted correctly"

I have the new user of Wolfram, now I am trying to type the code by using NeuralNetwork, the coding to be like this.

index = {103.244, 145.125, 156.575, 179.2, 225.758, 315.217, 235.025,
248.392, 272.283, 265.067, 259.2, 265.517, 259.2, 254.6, 303.833, 353.425, 366.775, 339.092};

time = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18};

trainData = Thread[time→index] ;

p=Predict[trainData, Method→"NeuralNetwork"]

p[{19 , 20, 21}]

However, the system error of “Predict: The data being evaluated is not formatted correctly”

May I ask why the format is not correct? And how can I solve the problem?
Thank you very much!

It looks like p wants a single number as input.

Thanks, but I have tried to take out the

Predict[trainData, Method→“NeuralNetwork”]

itself to run, then get the same result

Ah. My mistake, I misread where the error message was located.

Hi N KF

Take a look at

index // Counts // ReverseSort

The value 259.2 appears twice. That is the problem, two different time values cannot have the same index value.

Should work now.

Hi Mariusz,

I was also wrong. The problem is the use of \[RightArrow] rather than ->. Nice catch!