python cartesian product code example
Example 1: pandas cartesian product
a = [1, 2, 3]
b = ["a", "b", "c"]
index = pd.MultiIndex.from_product([a, b], names = ["a", "b"])
pd.DataFrame(index = index).reset_index()
Example 2: python list comprehension cartesian product
[ (x, y) for x in xs for y in ys ]