title: Python: preprocess data in a format to mine for Association rules and frequent itemsets (apriori/SPADE)
body: <p>I have a dataframe of the format consisting of 245 rows and 2 columns in which the column <strong>Unique</strong> consists of lists :</p>
  
  <pre><code>df = (pd.DataFrame({'TC': ['101', '102', '103'], 
                      'Unique': [[189,113,213,201,125,211],   
                                 [206,268,446,149,104,166],
                                 [163,103,113,166,800,101]]}))
  </code></pre>
  
  <p>i want to iterate through the dataframe and explode the lists in <strong>Unique</strong> into separate columns so that i can run some  frequent itemset mining algorithm on my data.
  <strong>expected output</strong></p>
  
  <pre><code>TC     0   1    2    3    4     5
  
  101   189  113  213  201  125  211 
  102   206  268  446  149  104  166
  103   163  103  113  166  800  101
  </code></pre>
  
  <p>Also, If possible i want to create a <strong>nested list</strong> of all unique field in sequential order:</p>
  
  <p><strong>ie</strong></p>
  
  <pre><code>unique=[[189,113,213,201,125,211 ],[206,268,446,149,104,166],[163,103,113,166,800,101]]
  </code></pre>