deepdiff
deepdiff copied to clipboard
TRYING TO COMPARE STR WITH FLOAT OR INT ?
I compare two dictionaries.. The first comes from a excel file and the second from an application.
In the first, all numbers (int, float) are some strings.
Example : d1 = {'a': '41'} d2 = {'a': 41} DeepDiff(d1, d2)
gives {'type_changes': {"root['a']": {'old_type': <class 'str'>, 'new_type': <class 'int'>, 'old_value': '41', 'new_value': 41}}}
instead of {}
ignore_numeric_type_changes=True doesn't work.
Could you help me ? Thanks
Hi, you are comparing a string to an integer. Currently DeepDiff doesn’t support what you are looking for. I will add some type conversation capabilities later.
Sep Dehpour
On Mar 21, 2020, at 8:11 AM, NathalieS-59 [email protected] wrote:
I compare two dictionaries.. The first comes from a excel file and the second from an application.
In the first, all number (int, float) are some string.
Example : d1 = {'a': '41'} d2 = {'a': 41} DeepDiff(d1, d2)
gives {'type_changes': {"root['a']": {'old_type': <class 'str'>, 'new_type': <class 'int'>, 'old_value': '41', 'new_value': 41}}}
instead of {}
ignore_numeric_type_changes=True doesn't work.
Could you help me ? Thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.