title: Removing List Within Pandas Dataframe
body: <p>I have the following dataframe:</p>
  
  <pre><code>Index   Recipe_ID   order   content
  0       1285        1       Heat oil in a large frypan with lid over mediu...
  1       1285        2       Meanwhile, add cauliflower to a pot of boiling...
  2       1285        3       Remove lid from chicken and let simmer uncover... 
  3       1289        1       To make the dressing, whisk oil, vinegar and m...
  4       1289        2       Cook potatoes in a large saucepan of boiling w..
  </code></pre>
  
  <p>Task: I need to get the contents in one cell:</p>
  
  <pre><code>df = df.groupby('recipe_variation_part_id', as_index=False).agg(lambda x: x.tolist())
  </code></pre>
  
  <p>This returns the following:</p>
  
  <pre><code>Index   Recipe_ID   order         content
  0       1285        [1, 2, 3]     [Heat oil in a large frypan with lid over medi...
  1       1289        [1, 2, 3]     [To make the dressing, whisk oil, vinegar and ...
  2       1297        [1, 2, 4, 3]  [Place egg in saucepan of cold water and bring...
  3       1301        [1, 2]        [Preheat a non-stick frying pan and pan fry th...
  4       1309        [2, 3, 4, 1]  [Meanwhile, cook noodles according to package ...
  </code></pre>
  
  <p>If you look at the first recipe entry, you get the following:</p>
  
  <pre><code>['Heat oil in a large frypan with lid over medium-high heat. Cook onions, garlic and rosemary for a couple of minutes until soft. Add chicken and brown on both sides for a few minutes, then add in tomatoes and olives. Season with salt and pepper and allow to simmer with lid on for 20-25 minutes. ',
   'Meanwhile, add cauliflower to a pot of boiling water and cook for 10 minutes or until soft. Drain and then mash and gently fold in olive oil, parmesan, salt and pepper. ',
   'Remove lid from chicken and let simmer uncovered for five minutes more. Sprinkle with parsley then serve with cauliflower mash. ']
  </code></pre>
  
  <p>This is what I want, but I need to remove the square brackets</p>
  
  <p>dtype = list</p>
  
  <p>I've tried:</p>
  
  <pre><code>df.applymap(lambda x: x[0] if isinstance(x, list) else x)
  </code></pre>
  
  <p>Only returns the first entry, not every step</p>
  
  <p>I've tried:</p>
  
  <pre><code>df['content'].str.replace(']', '')
  </code></pre>
  
  <p>Only returns NANs</p>
  
  <p>I've tried:</p>
  
  <pre><code>df['content'].str.replace(r'(\[\[(?:[^\]|]*\|)?([^\]|]*)\]\])', '')
  </code></pre>
  
  <p>Only returns NANs</p>
  
  <p>I've tried:</p>
  
  <pre><code>df['content'].str.get(0)
  </code></pre>
  
  <p>Only returns the first entry</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>If you need any further information, please let me know.</p>