The Buddha shares an observation on how beings come together and associate based on their dispositions. Those with a good disposition come together and associate with others of a similar good disposition.
Caṅkamasutta - Walking Back and Forth
At one time, the Blessed One was dwelling in Rājagaha, on the Vulture Peak Mountain. At that time, the Venerable Sāriputta was walking back and forth with many bhikkhus not far from the Blessed One; the Venerable Mahāmoggallāna was also walking back and forth with many bhikkhus not far from the Blessed One; the Venerable Mahākassapa was also walking back and forth with many bhikkhus not far from the Blessed One; the Venerable Anuruddha was also walking back and forth with many bhikkhus not far from the Blessed One; the Venerable Puṇṇa Mantāniputta was also walking back and forth with many bhikkhus not far from the Blessed One; the Venerable Upāli was also walking back and forth with many bhikkhus not far from the Blessed One; the Venerable Ānanda was also walking back and forth with many bhikkhus not far from the Blessed One; and Devadatta was also walking back and forth with many bhikkhus not far from the Blessed One.
Then the Blessed One addressed the bhikkhus: "Bhikkhus, do you see Sāriputta walking back and forth with many bhikkhus?"
"Yes, venerable sir."
"All these bhikkhus are of great wisdom. Do you see Moggallāna walking back and forth with many bhikkhus?"
"Yes, venerable sir."
"All these bhikkhus have great supernormal powers. Do you see Kassapa walking back and forth with many bhikkhus?"
"Yes, venerable sir."
"All these bhikkhus are ascetics of austere practices. Do you see Anuruddha walking back and forth with many bhikkhus?"
"Yes, venerable sir."
"All these bhikkhus have supernormal vision. Do you see Puṇṇa Mantāniputta walking back and forth with many bhikkhus?"
"Yes, venerable sir."
"All these bhikkhus are teachers of the Dhamma. Do you see Upāli walking back and forth with many bhikkhus?"
"Yes, venerable sir."
"All these bhikkhus are masters of the discipline. Do you see Ānanda walking back and forth with many bhikkhus?"
"Yes, venerable sir."
"All these bhikkhus are very learned. Do you see Devadatta walking back and forth with many bhikkhus?"
"Yes, venerable sir."
"All these bhikkhus have evil desires."
"Bhikkhus, beings come together and associate according to disposition. Those with an inferior disposition come together and associate with those of similar inferior disposition; those of a good disposition come together and associate with those of a similar good disposition."
"In the past, too, bhikkhus, beings came together and associated according to disposition. Those with an inferior disposition came together and associated with those of an inferior disposition; those with a good disposition came together and associated with those of a similar good disposition. In the future, too, bhikkhus, beings will come together and associate according to disposition. Those with an inferior disposition will come together and associate with those of a similar inferior disposition; those with a good disposition will come together and associate with those of a similar good disposition. Even now, bhikkhus, beings come together and associate according to disposition. Those with an inferior disposition come together and associate with those of a similar inferior disposition; those with a good disposition come together and associate with those of a similar good disposition."