The rapid development of metaheuristic algorithms proves their advantages in optimization. Data clustering, as an optimization problem, faces challenges for high accuracy. The K-means algorithm is traditaaional but has low clustering accuracy. In this paper, the phase-angle-encoded snake optimization algorithm (θ-SO), based on mapping strategy, is proposed for data clustering. The disadvantages of traditional snake optimization include slow convergence speed and poor optimization accuracy. The improved θ-SO uses phase angles for boundary setting and enables efficient adjustments in the phase angle vector to accelerate convergence, while employing a Gaussian distribution strategy to enhance optimization accuracy. The optimization performance of θ-SO is evaluated by CEC2013 datasets and compared with other metaheuristic algorithms. Additionally, its clustering optimization capabilities are tested on Iris, Wine, Seeds, and CMC datasets, using the classification error rate and sum of intra-cluster distances. Experimental results show θ-SO surpasses other algorithms on over 2/3 of CEC2013 test functions, hitting a 90% high-performance mark across all clustering optimization tasks. The method proposed in this paper effectively addresses the issues of data clustering difficulty and low clustering accuracy.