The recent discovery of superconductivity in La 3 Ni 2 O 7-δ under high pressure with a transition temperature around 80 K (ref. 1 ) has sparked extensive experimental 2-6 and theoretical efforts 7-12 . Several key questions regarding the pairing mechanism remain to be answered, such as the most relevant atomic orbitals and the role of atomic deficiencies. Here we develop a new, energy-filtered, multislice electron ptychography technique, assisted by electron energy-loss spectroscopy, to address these critical issues. Oxygen vacancies are directly visualized and are found to primarily occupy the inner apical sites, which have been proposed to be crucial to superconductivity 13,14 . We precisely determine the nanoscale stoichiometry and its correlation to the oxygen K-edge spectra, which reveals a significant inhomogeneity in the oxygen content and electronic structure within the sample. The spectroscopic results also reveal that stoichiometric La 3 Ni 2 O 7 has strong charge-transfer characteristics, with holes that are self-doped from Ni sites into O sites. The ligand holes mainly reside on the inner apical O and the planar O, whereas the density on the outer apical O is negligible. As the concentration of O vacancies increases, ligand holes on both sites are simultaneously annihilated. These observations will assist in further development and understanding of superconducting nickelate materials. Our imaging technique for quantifying atomic deficiencies can also be widely applied in materials science and condensed-matter physics.