You should move `reduce` to `pandas.compat` and import from there since there's no builtin `reduce` in Python 3