I am using this for loop to separate dataset into groups. but the list "y" is converting into an array with an error.
def to_sequences(dataset, seq_size=1):
x = []
y = []
for i in range(len(dataset)-seq_size):
window = dataset[i:(i+seq_size), 0]
x.append(window)
window2 = dataset[(i+seq_size):i+seq_size+5, 0]
y.append(window2)
return np.array(x),np.array(y)
seq_size = 5
trainX, trainY = to_sequences(train, seq_size)
print("Shape of training set: {}".format(trainX.shape))
print("Shape of training set: {}".format(trainY.shape))
And this is the error message I get
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. return np.array(x),np.array(y)
Couldn't find the issue why it is working for 'x' and not for 'y'. Any idea ?