title: Inputing samples from a dataframe into an ARMA model and getting 'ValueError: setting an array element with a sequence.'
body: <p>I have an 8 by 7 dataframe ‘selected_parameters’ as following</p>
  <p><a href="https://i.stack.imgur.com/fz6fA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fz6fA.png" alt="selected_parameters_dataframe" /></a></p>
  <p>ar_params and ma_params corresponds to the evaluated parameters of an ARMA model on a time series.</p>
  <p>I then select randomly one parameter from ar_params and ma_params:</p>
  <pre><code>ar_sample = selected_parameters['ar_params'].sample(1)
  ma_sample = selected_parameters['ma_params'].sample(1)
  </code></pre>
  <p>And modify them as follow in order to be then used to generate time series with an ARMA process, following the explanations at the end of this page</p>
  <p><a href="https://www.statsmodels.org/stable/generated/statsmodels.tsa.arima_process.arma_generate_sample.html" rel="nofollow noreferrer">https://www.statsmodels.org/stable/generated/statsmodels.tsa.arima_process.arma_generate_sample.html</a></p>
  <pre><code>ar_sample_array = np.r_[1, -ar_sample]
  ma_sample_array = np.r_[1, ma_sample]
  
  y = arma_generate_sample(ar_sample_array, ma_sample_array, nsample=100, scale=0.1)
  plt.plot(y)
  </code></pre>
  <p>Everything works well IF we did select a set of ar_params and ma_params including only ONE value.</p>
  <p>If at the random selection stage, we did select a set with two or more values I receive the following error message.</p>
  <pre><code>‘ValueError: setting an array element with a sequence.’
  </code></pre>
  <p>When printing the values of ar_sample_array and ma_sample_array</p>
  <pre><code>print(ar_sample_array)
  print(ma_sample_array)
  </code></pre>
  <p>I get the following output</p>
  <pre><code>[1 array([-1.01,  0.01])]
  [1 array([-0.76,  0.03])]
  </code></pre>
  <p>Thank you</p>