How to Solve NameError: name 'combinations' is not defined -- itertools
Solution: Import the 'combinations' module
# Add the following line to the top of your code
from itertools import combinations
For more information:
itertools combinations