title: random sampling with pandas dataframe
body: <p>I'm relatively new to pandas (and python... and programming) and I'm trying to do a Montecarlo simulation, but I have not being able to find a solution that takes a reasonable amount of time</p>
  
  <p>The data is stored in a data frame called "YTDSales" which has sales per day, per product</p>
  
  <pre><code>Date          Product_A     Product_B     Product_C     Product_D     ...   Product_XX
  01/01/2014         1000           300            70         34500     ...          780   
  02/01/2014          400           400            70            20     ...           10   
  03/01/2014         1110           400          1170            60     ...           50   
  04/01/2014           20           320             0         71300     ...           10   
         ...
  15/10/2014         1000           300            70         34500     ...         5000
  </code></pre>
  
  <p>and what I want to do is to simulate different scenarios, using for the rest of the year (from October 15 to Year End) the historical distribution that each product had. For example with the data presented I will like to fill the rest of the year with sales between 20 and 1100. </p>
  
  <p>What I've done is the following</p>
  
  <pre><code># creates range of "future dates"
  last_historical = YTDSales.index.max()
  year_end = dt.datetime(2014,12,30)
  DatesEOY = pd.date_range(start=last_historical,end=year_end).shift(1)
  
  # function that obtains a random sales number per product, between max and min
  f = lambda x:np.random.randint(x.min(),x.max())
  
  # create all the "future" dates and fill it with the output of f
  for i in DatesEOY:
      YTDSales.loc[i]=YTDSales.apply(f)
  </code></pre>
  
  <p>The solution works, but takes about 3 seconds, which is a lot if I plan to 1,000 iterations... Is there a way not to iterate?</p>
  
  <p>Thanks</p>