I know you can take the pairwise cross product of lists in the ways posted here: Pairwise crossproduct in Python but I want to take a list L and a positive integer n and return the cross-product of L with itself n times. Is there a built in way to do this or will I just have to iterate the
Tag: cartesian-product
Cartesian product of x and y array points into single array of 2D points
I have two numpy arrays that define the x and y axes of a grid. For example: I’d like to generate the Cartesian product of these arrays to generate: In a way that’s not terribly inefficient since I need to do this many times in a loop. I’m assuming that converting them to a Python list and using itertools.product and
All combinations of a list of lists [duplicate]
This question already has answers here: How to get the cartesian product of multiple lists (17 answers) Closed 8 months ago. I’m basically looking for a python version of Combination of List<List<int>> Given a list of lists, I need a new list that gives all the possible combinations of items between the lists. The number of lists is unknown, so