Beings come together and associate according to disposition. Those with little learning come together and associate with those with little learning; and other pairs of dispositions are mentioned.
Appassutamūlaka sutta - Beginning With Little Learning
At Sāvatthi.
"Bhikkhus, beings come together and associate according to disposition. Those with little learning come together and associate with those with little learning; the indolent come together and associate with the indolent; the undiscerning come together and associate with the undiscerning; the very learned come together and associate with those with much learning; those with energy aroused come together and associate with those with energy aroused; the wise come together and associate with the wise.
Those with little learning come together and associate with those with little learning; the unmindful come together and associate with the unmindful; the undiscerning come together and associate with the undiscerning; the very learned come together and associate with the very learned; those attending mindfully come together and associate with those attending mindfully; the wise come together and associate with the wise."