Forecast Model - transform flat list of data into 2D array

Viewed 25

I am attempting to build a small program that will help forecast future demand based on some inputs. Three key pieces of input are demand, on-hand, in-transit. The demand is passed as a list of 52 elements and the in-transit array would need to match it's length The problem I'm running into is initializing the in-transit data.

Demand data looks like this:

d = [100, 221, 470, 100, 250,...]

For the program to properly forecast, I need to pass the in-transit data in over a 52 week period. If I only have inbound inventory in week 3 for example, my data would look like this:

transit = [0, 0, 378,...]

Is there a way that I can pass this data into a numpy array and feed this to the program? Currently I'm using np.zero to initialize but that would only work if I didn't have inventory scheduled to arrive.

Code Snippet

# Determine the starting on hand and transit arrays
hand = np.zeros(time, dtype=int) 
transit = np.zeros((time,L+1), dtype=int)

What the beginning array outputs when initialized with np.zero:

[[   0    0    0    0    0    0    0    0    0]
 [   0    0    0    0    0    0    0    0 6429]
 [   0    0    0    0    0    0    0    0    0]
 [   0    0    0    0    0    0    0    0    0]
 [   0    0    0    0    0    0    0    0    0]
 [   0    0    0    0    0    0    0    0    0]]
0 Answers
Related