[SciPy-user] compare two csv files

Fabian Braennstroem f.braennstroem@gmx...
Wed Feb 6 14:54:43 CST 2008


Hi Zachary,

Zachary Pincus schrieb am 01/29/2008 04:10 PM:
> Hi Fabian,
> 
> Perhaps you could specify your problem more clearly. Basically, you  
> want to write a python function that takes two values and calls them  
> "equal" or not (in a fuzzy manner), and then you want to apply that  
> function along a column of data?
> 
> This is probably best handled in pure python, until you get a little  
> more comfortable with the basic language and want to learn numpy/ 
> scipy. But first things first.
> 
> So -- you need to specify *exactly* what sort of "fuzzy" matches are  
> acceptable. Then you need to transform this specification into a  
> python function. Given this, it's easy to compare two lists:
> 
> 
> list1 = [...whatever...]
> list2 = [...whatever...]
> 
> def are_fuzzy_equal(element1, element2):
>    ...whatever...
> 
> list3 = []
> for element1, element2 in zip(list1, list2):
>    if are_fuzzy_equal(element1, element2):
>      list3.append(element1)
> 
> If your question is about how to implement are_fuzzy_equal, you'll  
> need to (a) specify that clearly, and (b) probably want to ask on a  
> basic python-language list. Or I'm sure some folks here would help in  
> a pinch.

Sorry for the delay... thanks for your help! It seems, that 
fuzzy stuff can be done using
the 'levenshtein_distance'.

Thanks!
Fabian



More information about the SciPy-user mailing list