The field of musical exploration grows rapidly with the rapid development of technology in the digital era. In this paper, the application of machine learning in music recommendation systems is mainly focused on and the existing data sets about Spotify are used to analyze and show how machine learning achieves musical personality recommendations. This paper mainly uses principal component analysis and the K-means clustering algorithm to realize the goal. Principal component analysis (PCA) helps people to reduce the dimensionality of the whole dataset, and this method helps people to retain key information and reduce the complexity of the data. The k-means clustering algorithm divides the songs into different clusters. These clusters show consistency in musical features, and the dots will cluster together. By visualization of the clusters, people can deeply interpret the relationship between distinct music genres and discover the areas of music and songs that users are interested in. This research not only explains how music exploration is implemented but also promotes the development of personalized music recommendation systems.