title: pandas series containing arrays
body: <p>I have a pandas dataframe column which looks a little like:</p>
  
  <pre><code>Out[67]:
  0      ["cheese", "milk...
  1      ["yogurt", "cheese...
  2      ["cheese", "cream"...
  3      ["milk", "cheese"...
  </code></pre>
  
  <p>now, ultimately I would like this as a flat list, but in attempting to flatten this, i noticed that pandas treats <code>["cheese", "milk", "cream"]</code> as <code>str</code> rather than <code>list</code> </p>
  
  <p>How would i go about flattening this so I end up with:</p>
  
  <pre><code>["cheese", "milk", "yogurt", "cheese", "cheese"...]
  </code></pre>
  
  <p>[EDIT]
  So the answer given below appears to be:</p>
  
  <p><code>s = pd.Series(["['cheese', 'milk']", "['yogurt', 'cheese']", "['cheese', 'cream']"])</code></p>
  
  <pre><code>s = s.str.strip("[]")
  df = s.str.split(',', expand=True)
  df = df.applymap(lambda x: x.replace("'", '').strip())
  l = df.values.flatten()
  print (l.tolist())
  </code></pre>
  
  <p>Which is great, question answered, answer accepted but it strikes me as rather inelegant solution.</p>