definition factorize: Map each unique object into a unique integer. Typically, the range of integers mapped to is from zero to the n - 1 where n is
Initialize your list of tuples as a Series, then call factorize:
factorize
pd.Series(tups).factorize()[0] [0 1 2 3 4 1 2]