Python Forum

Full Version: Clusters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, please can you help me with creating clusters. I have one column x with number(1,2,6,8,4,7,5,9,8,2,4,9,3). I would like to create three clusters (0-3,4-6,7-9). Can you help me. How can I create these clusters in python. And i would like to create new column with these clusters.

for example

x y
1 0-3
2 0-3
6 4-6


Thank you so much for yours answers.
what have you tried so far?
Please show your code
I do not try anything, because i did not find anything about it , how it is do.
Come on, we aren't here to do the work for you. You must at least have some thoughts on how to break the problem down.
i know that we are not here to do the work for me, but i did not find anything about this in the internet or forum. I know what i want but i do not know how i can do it.
You won't always find code for the very specific thing you want to do, so it's critical to be able to solve problems. Imagine you had no computer and were given this data. How would you produce the result you want?
There are lots of references to this,
google: 'create clusters from tuple python'