How to calculate similarity between categorical variables in collaborative filtering
One good example to calculate distance between categorical features is Hamming Distance where we calculate the number of different instances.
On the other hand, you can still calculate Cosine Similarity for user-item data set.
As an example; 
user 1 buys item 1, item 2
user 2 buys item 2, item 3
Then, user vectors are;
user 1 = [1, 1, 0]
user 2 = [0, 1, 1]
And cosine similarity will be 0.5
Same rules apply for items.
I am trying to build a recommender system using collaborative filtering.

I am having user-item dataset. I am unable to find similarity between similar user, since i cannot use  Euclidean / Cosine distance will not work here. 
If i convert categorical variable into 0, 1 then will not able to calculate distance.
Can you please suggest any recommendation algorithm in python which handles categorical data.