ERR: Cartesian product error
- [x] closes #31355
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Added a test to trigger the reported error using code from the issue. An if statement was included to return a more helpful error message - borrowing the solution from the issue.

Replacement of [this](https://github.com/pandas-dev/pandas/pull/36169) pull request.