In Python, how do I build an array of coordinates given 2 lists of axes, such that the output array contains all the possible coordinate pairs?
e.g.
ax1=[1,3,4]
ax2=[a,b]
"""
Code that combines them
"""
Combined_ax1 = [1,3,4,1,3,4,1,3,4]
Combined_ax2 = [a,a,a,b,b,b,c,c,c]
I need this so I can feed combined_ax1 and combined_ax2 into a function without using multiple for loops.
itertools.productCombined_ax2, Combined_ax1 = zip(*itertools.product(['a', 'b', 'c'], [1, 3, 4]))gets you(1, 3, 4, 1, 3, 4, 1, 3, 4)and('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c')ccome from?