Convert categorical variable to numeric values or dummies for k-means clustering? I am using K-Means clustering algorithm on a dataset. One variale has 6 categories and I want to know how to deal with this.
I am thinking of two approaches:  


*

*Converting the values to 1,2,3,4,5,6  

*Converting that variable in dummy variable using pd.get_dummies()
Which approach should I use?
 A: I am going to assume here in my answer that you wish to use the variable in a regression analysis. Basically, this is a question of level of measurement of your variable. 
If the variable in question is of categorical kind, say "favourite colour" or "occupation", then converting it to dummy variables is the only viable option.
If the variable is a discrete variable measured on a ratio scale, then using it as a numerical variable is the correct approach. In that case, you can also use them as categories, but at a loss of power since you then have to estimate more parameters in your model which leads to fewer degrees of freedom. So if you have a small sample size, this can prove problematic. On the other hand, if you have a large sample size and believe that the way the variable affects the outcome is highly non-linear, then you can use dummy variables instead to lessen the burden of specifying the non-linearity correctly. 
For ordinal level variables, it is typically recommended to go the dummy variable approach, but if the "steps" between the levels are approximately the same, then you likely won't lose much from treating it as a ratio scaled variable.
A: Using the number representation of the categories only makes sense if you can define an order < on them. 
For example, you might define an order over countries by looking at the number of inhabitants or any other quantity that is associated with it. However, in those cases, it makes more sense to use the quantities directly as features (if they are known).
A reasonable example could be the stages in a linear process: so if you want to model the state of a 4-stage process, you might want to interpret the current state as an integer taking values 0 to 3. This makes sense, since a process in stage 2 for example always has passed stages 0 and 1 before.
If there is no ordering that you want to exploit, stick with dummy variables.
