We conducted a comparative study of the magnetic and transport properties of single-crystalline LaCo2As2 and NdCo2As2. LaCo2As2 is a soft metallic ferromagnet which exhibits purely intrinsic anomalous Hall effect (AHE) due to Co-3d electrons. With Nd-4f electronic magnetism, ferrimagnetic NdCo2As2 manifests pronounced sign reversal and multiple hysteresis loops in temperature and field dependent magnetization, Hall resistivity and magnetoresistance, due to complicated magnetic structural changes. We reveal that the AHE for NdCo2As2 is stemming from the Co sub-lattice and deduce its phase diagram which includes magnetic compensation and two meta-magnetic phase transitions. The sensitivity of the Hall effect on the details of the magnetic structures in ferrimagnetic NdCo2As2 provides a unique opportunity to explore the magnetic interaction between 4f and 3d electrons and its impact on the electronic structure.