Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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

  • Python 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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