Created
June 1, 2019 04:51
-
-
Save singhrahuldps/24ffcf0be56aba232ef8762347202591 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this function returns a python dictionary | |
# which maps each id to a corresponding index value | |
def list_2_dict(id_list:list): | |
d={} | |
for id, index in zip(id_list, range(len(id_list))): | |
d[id] = index | |
return d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment