title: Bootstrapping: Is there a faster way?
body: <p>I'm trying to compute the bootstrap statistic of the total of an array and I'm wondering if this can be improved in terms of speed, please?</p>
  
  <pre><code>from numpy import sum
  from numpy.random import choice
  
  def bootstrap(observed_array: array, number_of_bootstraps: int = 10000) -&gt; array:
      number_of_elements = len(observed_array)
      bootstrap_estimates = []
      for _ in range(number_of_bootstraps):
          indices = choice(number_of_elements, size=number_of_elements, replace=True)
          bootstrap_sample = observed_array[indices]
          bootstrap_estimate = bootstrap_sample.sum()
          bootstrap_estimates.append(bootstrap_estimate)
      return array(bootstrap_estimates)
  </code></pre>
  
  <p>Thanks for any suggestions here.</p>