Import fuzzydict

#1

I have an issue after importing fuzzydict using Library Manager. Can anyone reproduce this issue?

I imported fuzzydict successfully but the fuzzy attributes appear to be missing. Below is an example where I try to access fuzzy_value, fuzzy_key, and fuzzy_item. The error message is 'Attribute Error: 'dict object has no attribute ‘fuzzy_values’ ’

# fuzzy lookup does not work
from fuzzydict import FuzzyDict

test_dict = FuzzyDict(0.5)
test_dict = {'Some Key': 'Value1', 'Another Key': 'Value2'}
# [key for key in test_dict.fuzzy_keys('Key')]
# [value for value in test_dict.fuzzy_values('Key')]
[(k,v) for (k,v) in test_dict.fuzzy_items('Key')]
#2

Hello!

It seems that this particular code doesn’t work because you redefine test_dict with a normal dict. Correct version would be something like

test_dict = FuzzyDict(0.5)
test_dict['Some Key'] = 'Value1'
test_dict['Another Key'] = 'Value2'

But this code doesn’t work in Datalore either, because the fuzzydict library doesn’t seem to support python 3, and Datalore works with python 3.6.3.

1 Like
#3

Thanks for the pointer on Python 3.6. That makes sense. I will use another approach for fuzzy search against a dictionary.