I need some help with this:

First of all, I wanted to "Compare strings from two fields", and asking before at gis.stackexchange, in this post someone help me with this topic, referring me to a Python code, but, unfortunately, from the deepest ignorance of this kind of issues, I wanted to know if it is possible to run this code within ArcGIS 10 (field calculator).

The code: PyLevenshtein ,

Thanks in advance, and sorry if I wasted your time.


First, you need to install it and it can be installed like any other Python module.

  • Python setup.py install
  • easy_install or pip install

But it is a Python C extension module (.so or .dll) and in Windows, there is no native compilers (as in Linux or Mac OS X). You can download and install a version "ready" from Christopher Gohlke's Unofficial Windows Binaries for Python Extension Packages


import Levenshtein
# absolute Levenshtein distance of two strings.
Levenshtein.distance('GIS StackExchange','StackExchange')
# similarity of two strings.
Levenshtein.ratio('GIS StackExchange','StackExchange')

You can also use the standard difflib module (Good Python modules for fuzzy string comparison?)

import difflib
difflib.SequenceMatcher(None, 'GIS StackExchange','StackExchange').ratio()

and others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.