KMeans clustering of textual data
<p>I have a pandas dataframe with the following 2 columns:</p>

<pre><code>      Database Name             Name

      db1_user                  Login
      db1_client                Login
      db_care                   Login
      db_control                LoginEdit
      db_technology             View
      db_advanced               LoginEdit
</code></pre>

<p>I have to cluster the Database Name based on the field âNameâ. When I convert it to a numpy, using </p>

<p>dataset = df2.values</p>

<p>When I print the print(dataset.dtype), the type is object. I have just started with Clustering, from what I read, I understand that object is not a type suitable for Kmeans clustering. </p>

<p>Any help would be appreicated!! </p>

<p>I don't understand whether you want to develop clusters for each GROUP of "Name" Attributes, or alternatively create n clusters regardless of the value of "Name"; and I don't understand what clustering could achieve here.</p>

<p>In any case, just a few days ago there was a similar question on the datascience SE site (from an R user, though), asking for similarity of local-names of email addresses (the part before the "@"), not of database-names. The problem is similar to yours. </p>

<p>Check this out:</p>

<p><a href="http://datascience.stackexchange.com/questions/14146/text-similarities/14148#14148">http://datascience.stackexchange.com/questions/14146/text-similarities/14148#14148</a></p>

<p>The answer was  comprehensive with respect to the <strong>different distance measures for strings</strong>. </p>

<p>Maybe this is what you should investigate. Then decide on a proper distance measure that is available in python (or one that you can program yourself), and that fits your needs.</p>

python dataframe cluster-analysis k-means