"Single-atom" catalysts (SACs) have demonstrated excellent activity and selectivity in challenging chemical transformations such as photocatalytic CO2 reduction. For heterogeneous photocatalytic SAC systems, it is essential to obtain sufficient information of their structure at the atomic level in order to understand reaction mechanisms. In this work, a SAC was prepared by grafting a molecular cobalt catalyst on a light-absorbing carbon nitride surface. Due to the sensitivity of the X-ray absorption near edge structure (XANES) spectra to subtle variances in the Co SAC structure in reaction conditions, different machine learning (ML) methods, including principal component analysis, K-means clustering, and neural network (NN), were utilized for in situ Co XANES data analysis. As a result, we obtained quantitative structural information of the SAC nearest atomic environment, thereby extending the NN-XANES approach previously demonstrated for nanoparticles and size-selective clusters.