0

I have a list that has the following format:

[ [[John],[Sam],[Jack]], [[Student],[Athlete],[Teacher]],[[1],[2],[3]] ]

How can i unzip this so that I have the following output list in Python:

[ [[John],[Student],[1]], [[Sam],[Athlete],[2]],[[Jack],[Teacher],[3]] ]

Essentially what I want is for the items with the 0th index in all the sublists to be together and so on.

Thanks!

  • In Python these are lists, not arrays. – Barmar Oct 29 '19 at 17:47
  • 2
    Why is each element nested in another list? I.e. why `["John"]` instead of just `"John"`? – Barmar Oct 29 '19 at 17:48
  • One way of doing this is apply a filter on the initial list say A to get a list of subarrays matching a certain len. Also @Barmar's question is valid. Why all elements are lists? – Nergon Oct 29 '19 at 17:55
  • All valid questions but I cant provide the data im working with. If I could it would make a lot more sense. But hank you @Barmar the transpose list of lists technique worked! – soccer_analytics_fan Oct 29 '19 at 18:11

0 Answers0