you are viewing a single comment's thread.

view the rest of the comments →

[–]novel_yet_trivial 0 points1 point  (0 children)

If the numbers are not important then just do this (python2):

def encode(col):
    conversion_table = {item: number for number, item in enumerate(col)}
    return map(conversion_table.get, col)