Skip to content

sample (randomly select) to get a number of successive days

2 messages · Dagmar Cimiotti, Marc Schwartz

#
Hi Jim and everyone else,

Mhm, no this is not what I am looking for. I think in your way I would 
randomly sample two values of day 1 and of day 2. But I want the 
opposite: I want to randomly draw two successive (!) days and put those 
values in a new dataframe to continue working with them.

In my real data I do have a huge time span and I want to draw 25 
consecutive days. So maybe my example was a little misleading. And now 
that I read it again my text was, too. Sorry about that!

Good try though and I am very gratefull for your good will to help me ?? 
Would anyone give another try?

Dagmar

Am 07.12.2018 um 10:30 schrieb Jim Lemon:

  
  
#
Hi,

I am confused.

As far as I can tell, only the first day is selected randomly from your dataset. The subsequent 24 days are deterministic, since they need to be consecutive days from the first day, for a total of 25 consecutive days. 

Thus, all you need to do is to randomly select 1 day from within the time range of your dataset to be the first day, that is also far enough from the maximum date, to allow you to then select the data from the additional 24 consecutive days.

So randomly pick your first day and set a range of values, covering the 25 days, to use to then subset your full dataset.

What am I missing?

Regards,

Marc Schwartz