I applied Pandas groupby to a dataframe to get all available combinations of a few fields as follows:
list_of_fields = [field1, field2, field3, field4] grouped =