Recent discovery of superconductivity in the doped infinite-layer nickelates has renewed interest in understanding the nature of high-temperature superconductivity more generally. The low-energy electronic structure of the parent compound NdNiO2, the role of electronic correlations in driving superconductivity, and the possible relationship betweeen the cuprates and the nickelates are still open questions. Here, by comparing LaNiO2 and NdNiO2 systematically within a parameter free density functional framework, all-electron first-principles framework, we reveal the role Nd 4f-electrons in shaping the ground state of pristine NdNiO2. Strong similarities are found between the electronic structures of LaNiO2 and NdNiO2, except for the effects of the 4f-electrons. Hybridization between the Nd 4f and Ni 3d orbitals is shown to significantly modify the Fermi surfaces of various magnetic states. In contrast, the competition between the magnetically ordered phases depends mainly on the gaps in the Ni dx2-y2 band, so that the ground state in LaNiO2 and NdNiO2 turns out to be striking similarity to that of the cuprates. The d - p band-splitting is found to be much larger while the intralayer 3d ion-exchange coupling is smaller in the nickelates compared to the cuprates. Our estimated value of the on-site Hubbard U is similar to that in the cuprates, but the value of the Hund's coupling JH is found to be sensitive to the Nd magnetic moment. The exchange coupling J in NdNiO2 is only half as large as in the curpates, which may explain why Tc in the nickelates is half as large as the cuprates.