title: How can i create this nested list using list comprehension?
body: <p>Every time I try to create a nested list using list comprehension it ends up being a major headache or comes out incorrectly. I have a transposed data frame of four variables that I'm working with that has 9 columns of each variable. For example:</p>
  <pre><code>Date0, Date1, Date2, Date3 ... Date 9
  GMV0, GMV1, GMV2, GMV3 .... GMV9
  Revenue0, Revenue1, Revenue2, Revenue3 .... Revenue9
  </code></pre>
  <p>I am trying to create a nested list for each of these columns. The desired list is as follows:</p>
  <pre><code>[[Date0, GMV0, Revenue0], [Date1, GMV1, Revenue1], [Date2, GMV2, Revenue2] ... [Date9, GMV9, Revenue9]]
  </code></pre>
  <p>I can currently create the desired list using</p>
  <pre><code>date=[col for col in test.columns if 'Date' in col]
  gmv=[col for col in test.columns if 'GMV' in col]
  rev=[col for col in test.columns if 'Gross Revenue' in col]
  
  vars=[[Date[i], gmv[i], rev[i]] for i in range(len(Date))]
  </code></pre>
  <p>But this is quite inefficient and I'm quite positive this is a one-liner code.</p>
  <p>Can someone help with the correct list comprehension (or possibly some other method that is specific to transposed data) and help me wrap my head around it?</p>