O → O− Oxygen accepts an electron and form O− by releasing energy. So electron affinity is negative. Second electron is added to an anion, so that will require energy to add and hence the electron affinity is positive. And the process is endothermic, so the process require absorption of energy.