Skip to content

Instantly share code, notes, and snippets.

@GDBSD
Created October 17, 2020 23:35
Show Gist options
  • Select an option

  • Save GDBSD/cdc6a749c9adb6dc6383b1ee28676768 to your computer and use it in GitHub Desktop.

Select an option

Save GDBSD/cdc6a749c9adb6dc6383b1ee28676768 to your computer and use it in GitHub Desktop.
Python - Compare Dictionaries
import numpy as np
def test_dict_equality(dict_1, dict_2):
false_matches = 0
for key in dict_1:
if key in dict_2:
if not np.array_equal(dict_2[key], dict_2[key]):
false_matches += 1
return false_matches == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment