Proverbs 14:7 Go from the presence of a foolish man, when thou perceivest not in him the lips of knowledge.
Jesus told us to not cast our pearls before the swine, lest they trample them under their feet and turn again and rend you.
There are people who could use our company, our fellowship, our counsel.
But then, there are those with whom we deal who are a complete waste of time and effort. Trying to impart wisdom to them is akin to putting money into pockets with holes.
They have little or nothing to offer when it comes to knowledge or wisdom. They are not receptive of truth. This passage, Proverbs 14, warns that what they offer is perverseness, pride, BS (go ahead, read in in verse 4), lies, deceit, mockery, gullibility, rage, over-confidence, anger, error, haste, envy, rottenness, oppression, wickedness, reproach and shame.
There are contexts where we are pretty much stuck with fools; at the job, in a class, perhaps even living under the same roof, and maybe in the same pew. But, when possible, we should avoid their folly. “Hi, how are you?” and “Bye” should suffice.