combinatorial explosion while merging dataframes in pandas,"from functools import reduce