Created
October 17, 2020 23:35
-
-
Save GDBSD/cdc6a749c9adb6dc6383b1ee28676768 to your computer and use it in GitHub Desktop.
Python - Compare Dictionaries
This file contains hidden or 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
| 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