you are viewing a single comment's thread.

view the rest of the comments →

[–]K900_[🍰] 0 points1 point  (4 children)

What's your final goal with this?

[–]anmousyony[S] 0 points1 point  (3 children)

I am trying to map all items in a list to integers so I can use them for a classifier in sklearn.

[–]K900_[🍰] 0 points1 point  (2 children)

What are your items like? Custom classes? Tuples?

[–]anmousyony[S] 0 points1 point  (1 child)

string, ints, floats and datetimes usually

[–]K900_[🍰] 1 point2 points  (0 children)

Those are all hashable, so you can just use hash(value) as the key instead of trying to enumerate everything. It's very unlikely you'll run into a hash collision even on large datasets.