changing data to clustering format