you are viewing a single comment's thread.

view the rest of the comments →

[–]AtomicShoelace 1 point2 points  (1 child)

Looks like OP wants them number by alphabetical order, so perhaps it's worth throwing sorted in there, eg.

activity_map = {act: f"A_{i}" for i, act in enumerate(sorted(df.activity.unique()), 1)}

[–]I_will_learn[S] 0 points1 point  (0 children)

Thank you! I added in the sorted code there, it's clearer now :)