Levenshtein Distance for a List
<p>I want to divide my word list into some number of clusters using Levenshtein Distance. </p>

<pre><code>data = pd.read_csv("data.csv")
Target_Column = data["words"]
Target = Target_Column.tolist()
clusters = defaultdict(list)
threshold =5
numb = range(len(Target))

for i in numb:
    for j in range(i+1, len(numb)):
        if distance(Target[i],Target[j]) &lt;= threshold:
            clusters[i].append(Target[j])
            clusters[j].append(Target[i])
</code></pre>

<p>But as I am running loop over list some clusters are repeated. Please help me to sort this problem</p>