I think the simplest is to iterate the Iterators.product
, which gives Tuple
s (that is, it loses name information). Then you can convert on the fly to named tuples, and pass the resulting iterator to DataFrame
. For example
function expand_grid(; kws...)
names, vals = keys(kws), values(kws)
return DataFrame(NamedTuple{names}(t) for t in Iterators.product(vals...))
end