I'm trying to generate 50 random samples of 30 continuous day periods from a list of corn prices (which is index by date).
So far I've got 'select 50 random days' on line one. For the second line, what I really want is an array of dataframes, each one containing 30 days from sample date. Currently it just returns the price on that day.
samples=np.random.choice(corn[:'1981'].index,50)
corn['Open'][samples] #line I need to fix
What's the cleanest way of doing that?
cornbefore hand?zip(samples, corn["Open"][samples])be what you are looking for?samplemethod to get random samples, I find it more elegant than the numpy method.