Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

module 'thefuzz' has no attribute 'partial_ratio' and other odd errors

Been trying to use thefuzz to compare two different lists, and got the above error, which doesn’t seem right. I’ve commented everything else out in my code except the below two test lines and still getting the error. I’ve also tried fuzz.ratio, fuzz.token_sort_ratio and fuzz.token_set_ratio and getting an error every time.

import thefuzz as fuzz

fuzz.partial_ratio("fuzzy was a bear", "wuzzy fuzzy was a bear")

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You want

import thefuzz.fuzz as fuzz

Or

from thefuzz import fuzz

As that is where the functions you want are found

The usage section of the thefuzz readme
(https://github.com/seatgeek/thefuzz/blob/master/README.rst) suggests:

from thefuzz import fuzz
from thefuzz import process
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading