You have heard it said "Tell me your friends and I will tell you who you are." Some spiritual writers will tell you to choose your friends wisely because bad company can corrupt a person. St. Teresa of Avila says in her Interior Castle that someone who struggles in the spiritual life is helped by having good and virtuous friends. But Jesus was known to be in the company of sinners and outcast? Isn't his example the only example we need? How do you balance this equation of wanting virtuous friends and extending one's charity to unsavory characters?
We can definitely learn from each other, "unsavory" and virtuous alike. But then this again require self-knowledge. We can learn even from bad company if we have that willingness or ability to learn. Unfortunately, people do have the ability to influence us for better or for worse. We need good judgment and humility to acknowledge where our vulnerabilities are so as to avoid occasions of sin (person, places or things). If we find that a certain company affects us in a negative way, I think it is prudent to avoid this company. We should not expose ourselves to situations that will make us fall. We can only be a good friend to others if we contribute to other's good. If we close our eyes and tolerate the bad in a friendship out of "respect" or "tolerance" it is just like the blind leading the blind and both will end up in a ditch! We show our love for our friends when we lead them to the path that will lead them to God. We are, whether we like it or not, our brother / sister's keeper. This is not a one-way street. Hopefully, my friends care enough for me to lead me back to the right path when I lose my way.
I believe this has all to do with timing and prudent judgment. Timing in the sense that if our spiritual life is weak and fragile, we need good company and virtuous friends to help us along. There is a "herd" mentality we find in some people. Peer pressure can be a real problem especially among the young. But there comes a time in our journey when we develop in strength and grace and what used to be a temptation for us before,no longer poses as a threat.
The book "Interior Castle" by St. Teresa discusses this subject in the First Three Mansions. In each of the Mansion we enter into there is a particular temptation to be met and to overcome, different from the other mansions. With this particular struggle, she proposes specific course of action. Once we develop the virtues and begin to enter even the Third Mansion, our first temptations no longer become the issue.
No, we cannot avoid people nor am I saying that we should deliberately shun them. That is not the teaching of Jesus. But we cannot give what we do not have (us to others) nor receive something (others to us) if we are not ready for it. A Philosopher once said "Know Thyself." Growth in the spiritual life is both active and infused, active and passive. This is how I would go about a particular scenario: George is getting on my nerves. I obviously need to work on my patience but I will take it a step further. In my prayer, asking the guidance of the Holy Spirit I would ask myself: "Why does George get on my nerves? Because he contradicts me often? Because he has a loud and abrasive personality? Because... How did Jesus react towards those who contradicted him? How did he react with those who had abrasive and coarse personalities? I react the way I do because maybe I hate to be contradicted? I find coarse people unattractive? Lord, give me patience to accept others as they are, not as I would want them to be." If one is honest with this type of exercise, one can acquire self-knowledge.
Sometimes people would tell us up front ""You are very bossy! You think you know everything!" Again, bring this to prayer and analyze yourself in the light of this assessment and contrast yourself to the example given us by Jesus. Self-knowledge is acquired this way. As one progresses in the interior life, God grants "lights" that will make us see ourselves quite differently. People may rave how humble we are, or how generous we are, or how detach we are, but the infused self-knowledge God gives us (true humility) tells us otherwise. The example of Jesus must be our measuring stick to gain true self-knowledge (studying his life and imitating his example in circumstances he found himself in.)
We can never make a fair determination because we cannot see the heart of the person, only God can. Our partial determination will depend on what we behaviorally see. I can tell by someone's behavior if it is wrong or not. I cannot judge the motive but I can make a judgment of the action. We cannot make a determination if we don't know what the Church teaches or what Jesus teaches about a particular behavior. This is where we need to know what the Catholic Church teaches. This is where we need to know what the Word of God teaches. I have relatives who are need of instructions and guidance in the practice of the Faith, friends who live loose lifestyles. I counsel them according to what I know of my Faith. There are things they do(even innocent "fun" they ask me to join) which are not proper for me to do because of my status as a Religious (it may not be sinful but just not proper for me as a Sister.) I tell them so and risk being misunderstood and jeopardizing friendships. But I won't be able to compromise under the pretense of "leading them to God" because I may end up offending him. "What does it matter if you gain the whole world and lose your soul." I know my weaknesses and strengths. Prayer is the key to enter the inner castle of our soul. Unless we bring all this to prayer it will just be an intellectual exercise. Prayer is the door to self-knowledge. This is my humble opinion.