We propose a new method to construct canonical partition functions of QCD from net number distributions such as the net-baryon, net-charge and net-strangeness, by using only the CP symmetry. To demonstrate the method, we apply it to the net-proton number distribution Pn recently measured at RHIC. We show that both µ/T and the canonical partition functions Zn are determined by using the CP invariance Zn = Z−n.Comparing µ/T obtained from the present analysis for the net-proton distribution and that obtained from a thermal statistical model, we find remarkable agreement for wide range of beam energies. Constructing a grand canonical partition function Z(µ, T ) = n Zn(T )ξ n , we study moments and Lee-Yang zeros for RHIC data, and discuss possible regions of a phase transition line in QCD. This is the first Lee-Yang zero diagram obtained for RHIC data, which helps us to see contributions of large net-proton data for exploring the QCD phase diagram.We also calculate Zn by the lattice QCD simulations, and find a clear indication of Roberge-Weiss phase transition in the QGP phase. The method does not rely on the Taylor expansions, which prevent us to go to large µ/T .