python – GPU based combinatoric resolver with table group by operations


Given a table with many columns

|-------|-------|-------|-------|
|   A   |   B   |  ..   |   N   |
|-------|-------|-------|-------|
|   1   |   0   |  ..   |   X   |
|   2   |   0   |  ..   |   Y   |
|  ..   |  ..   |  ..   |  ..   |
|-------|-------|-------|-------|

What is the most efficient way to iterate over all column combinations and perform a GROUP BY operation? As the table can be quite large, preferable with GPU support?

 colnames = df.columns
 L = 2
 for comb in itertools.combinations(colnames, L):
   dfg = df.groupby(comni, sort=False).size().reset_index().rename(columns={0:'count'})