Going
Deeper
Electrons Spin Combinations in Different Orbitals

Why is it better (more stable) to have an occupation like 2px(↑)2py(↑) than 2px(↑)2py(↓)?

This may seem to contradict what we've seen repeatedly, that the Pauli principle tells us that opposite spins are better than the same spin. That's true, if we're trying to put two electrons into the same orbital or the same space. But quantum mechanics tells us the repulsion between a pair of electrons with the same spin in different orbitals is less repulsive than the repulsion between a pair of electrons with different spins in different orbitals. The effect is called exchange correlation.

We sometimes call this favorable triplet coupling.