I have an array of values with a length of y (y = 7267).
I am splitting the data based on x (x = 24) as shown below.
I miss some values here because 7267/24 gives 302, not 302.8. This is because I am taking integer values.
If I set int
to float
in the 3rd line, I get an error TypeError: 'float' object cannot be interpreted as an integer
.
How can I run the following code without losing any values in y? or maybe there is a better way of splitting the data like here?
import numpy as np
y = np.random.rand(7267)
samples = len(y)
x = 24
trim = samples % x
subsequences = int(samples/x)
sequence_trimmed = y[:samples - trim]
sequence_trimmed.shape = (subsequences, time_steps, 1)