Skip to content

Instantly share code, notes, and snippets.

@daguiam
Created September 26, 2017 15:39
Show Gist options
  • Save daguiam/dc81e7398a8e64d69a44ecc2b87c5ff5 to your computer and use it in GitHub Desktop.
Save daguiam/dc81e7398a8e64d69a44ecc2b87c5ff5 to your computer and use it in GitHub Desktop.
def convert_dict_keys_to_numpy(dictionary):
"""
Converts each element in dictionary to numpy array
Parameters:
----------
dictionary : dict
Dictionary where each element is a list that must be converted to array
Returns:
-------
dictionary : dict
"""
for key in dictionary.keys():
dictionary[key] = np.array(dictionary[key])
return dictionary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment