Electron affinity increases as you move across a period on the periodic table. Nonmetals tend to gain electrons to form negative ions, and they release energy when this happens. That amount of energy is electron affinity.
Metals tend to lose electrons to form positive ions, and they will not gain electrons at all. Thus, they do not release energy in the form of electron affinity.
Electron affinity increases as you go from the bottom to the top of a group (column) on the periodic table. Elements at the top of a group (or family) are smaller in size, with electrons closer to the nucleus. The nucleus has a greater attraction for adding electrons.