<p>There's a variation of k-means which is called k-modes, Published here</p>

<p><a href="http://www.cs.ust.hk/~qyang/Teaching/537/Papers/huang98extensions.pdf" rel="nofollow noreferrer">http://www.cs.ust.hk/~qyang/Teaching/537/Papers/huang98extensions.pdf</a></p>

<p>This is suitable for categorical data. </p>

<p>Please note here that the solutions you get are sensitive to initial conditions, as discussed here </p>

<p><a href="https://arxiv.org/ftp/cs/papers/0603/0603120.pdf" rel="nofollow noreferrer">https://arxiv.org/ftp/cs/papers/0603/0603120.pdf</a></p>

<p>see this for pythonic implementation</p>

<p><a href="http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html" rel="nofollow noreferrer">http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html</a> </p>
Is there a way to find patterns based on categories in a pandas DataFrame?
<p>I was wondering if there was a way to find patterns in a pandas DataFrame based on categories.</p>

<p>I know kmeans works for numeric values but my dataframe mainly consists of categories and dates:</p>

<pre><code>car   check   jobcard   date        season 
merc  A       12A       01-01-2010  Winter
bmw   B       45A       03-02-2010  Winter
merc  A       12D       10-01-2010  Winter
bmw   C       25C       01-05-2010  Spring
vw    A       62B       01-08-2010  Summer
etc
</code></pre>

<p>It goes on for about 5000 rows, the dataset represents different types of checks that required repairs after the check, and I would like to see a pattern, for instance a BMW has problems mainly in the summer, or the 12A jobcard never happens in the winter. I have already made some scatterplots, but I was not able to get any results from them: Scatterplot</p>

<p><a href="https://i.stack.imgur.com/JTn56.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JTn56.png" alt="enter image description here"></a></p>

<p>Is there any package that can provide a better overview or that can cluster categories in the same way kmeans does with numeric values?</p>