# How to combine a list with a list of sublists

i hope some of you can support to solve my problem, i need to work on data in the following way, where the length of each of the lists or sublists is equal. As an example i want to share the data-pattern with you:

list1={a,b,c};
list2={{d,e,f},{g,h,i},......} (in reality the number of sublists in list2 is about 30)
data=list2[[1]]


the goal is now to combine these lists in the following form { {{a,d},{b,e},{c,f}}, {{a,g},...} ...} .

The next step to plot it or to create a fit-formula. The values of list1 should be always plotted as the x-Data. I created some of the most interesting datasets as follows: 

plottedList=Table[{list1[[k]], data[[k]]}, {k, 1, Length[data]}]
ListPlot[plottedList]


My Problem is that i now would need to plot all of the data-pairs and combine the data to create the lists which i can find a linear or nonlinear fit.

I hope you can give me some advice, Best Chris!

• To answer the second part of your question (which probably should be its own separate question altogether), it would be much more helpful if you could share a portion of the actual numerical data and specify what problems you encountered that are not solved by the approaches proposed in the answers below. Commented Dec 21, 2021 at 15:30

## 4 Answers

A minor variation based on @kglr's answer.

list1 = {a, b, c};
list2 = {{d, e, f}, {g, h, i}};
MapThread[List, {list1, #}] & /@ list2


Using Transpose:

Transpose[{list1, #}] & /@ list2


Result:

{{{a, d}, {b, e}, {c, f}}, {{a, g}, {b, h}, {c, i}}}

list1 = {a, b, c};
list2 = {{d, e, f}, {g, h, i}};

Map[Thread[{list1, #}] &] @ list2

{{{a, d}, {b, e}, {c, f}}, {{a, g}, {b, h}, {c, i}}}

Inner[{#2,#1}&,list2,list1,List]

(* {{{a, d}, {b, e}, {c, f}}, {{a, g}, {b, h}, {c, i}}} *)


A Slot-free version

J. M. can't deal with it (in a comment) gives the following neat modification:

Inner[ReverseApplied[List], list2, list1, List]


Lists

list1 = {a, b, c};
list2 = {{d, e, f}, {g, h, i}};

• Very nice. Here's a slot-free version: Inner[ReverseApplied[List], list2, list1, List] Commented Dec 22, 2021 at 13:27
la = {a, b, c};

lb = {{d, e, f}, {g, h, i}};


Using Table

Table[Transpose[{la, lb[[n]]}], {n, 2}]


{{{a, d}, {b, e}, {c, f}}, {{a, g}, {b, h}, {c, i}}}

Using ReplacePart

ReplacePart[lb, n_ :> Transpose[{la, lb[[n]]}]]
`

{{{a, d}, {b, e}, {c, f}}, {{a, g}, {b, h}, {c, i}}}