expand_grid#

er_evaluation.expand_grid(**kwargs)[source]#

Create DataFrame from all combination of elements.

Parameters:

kwargs – Dictionary of elements to combine. Keys become column names.

Returns:

DataFrame with columns corresponding to argument names and rows for each combination of argument values.

Return type:

DataFrame

Examples

>>> expand_grid(col1=[1,2], col2=["a", "b"])
   col1 col2
0     1    a
1     1    b
2     2    a
3     2    b
>>> expand_grid(col1={1:"something", 2:"something"}, col2=["a", "b"])
   col1 col2
0     1    a
1     1    b
2     2    a
3     2    b