title: combine output of multiple functions into a pd.Series in python (like c() in R)
body: <p>I've been using <code>R</code> for data analysis and am trying to learn <code>python</code>. In R, I can create vectors with <code>c()</code>, which gives me back a "column" resulting from whatever I pass it. I often use it to concatenate sequences or repeated values. Something like this:</p>
  
  <pre><code>&gt; test &lt;- c(rep(1:2, each = 2), seq(5, 10, by = 2), runif(3))
  &gt; test
   [1] 1.0000000 1.0000000 2.0000000 2.0000000 5.0000000 7.0000000 9.0000000
   [8] 0.9237168 0.5051230 0.2367923
  </code></pre>
  
  <p>What is the pythonic way to do this (guessing with <code>pandas</code> or <code>numpy</code>)?</p>
  
  <hr>
  
  <p><a href="https://stackoverflow.com/questions/32443778/python-equivalent-of-r-c-function">This question</a> is the closest I've found, but it's only putting together <code>range()</code> objects. Trying to do the above in <code>python</code>, storing the output as a <code>pd.Series</code>, I tried:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  
  test = pd.Series([np.repeat([1, 2], 2), 
                    np.arange(5, 10, 2),
                    np.random.random_sample(3)])
  </code></pre>
  
  <p>That gets me a sort of nested thing:</p>
  
  <pre><code>0                                        [1, 1, 2, 2]
  1                                           [5, 7, 9]
  2    [0.989736164378, 0.558979301843, 0.385354683044]
  dtype: object
  </code></pre>
  
  <p>I see that I could <a href="https://stackoverflow.com/questions/952914/making-a-flat-list-out-of-list-of-lists-in-python">flatten the list manually</a> but that seems like overkill. I magically googled onto <a href="https://stackoverflow.com/questions/34898159/python-pandas-series-combine-the-rows">this question</a> which contained the potentially helpful <code>tolist()</code> function which I hadn't heard of. While that's about getting some row of dataframes (??) into a <code>pd.Series</code>, the function seems like it might do the trick?</p>
  
  <p>Combining that I can use <code>+</code> to add lists (gleaned from the first linked question), and the <code>tolist()</code> bit from the last one, I found this:</p>
  
  <pre><code>test1 = np.repeat([1, 2], 2).tolist()
  test2 = np.arange(5, 10, 2).tolist()
  test3 = np.random.random_sample(3).tolist()
  
  test = pd.Series(test1 + test2 + test3)
  
  0    1.000000
  1    1.000000
  2    2.000000
  3    2.000000
  4    5.000000
  5    7.000000
  6    9.000000
  7    0.472650
  8    0.077398
  9    0.672734
  dtype: float64
  </code></pre>
  
  <p>Hopefully what I'm trying to do is clear. I like that with <code>c()</code>, you pass in whatever you want and can elegantly string together a series of generated numbers in a desired pattern. I was surprised by how tough it was to do this with a <code>pd.Series</code> and infer from that I'm doing it wrong!</p>
  
  <p>How is this typically done with <code>python</code>?</p>