The Buddha has spoken many times about giving up bad friends, we can find it in the Dhammapada, in the beautiful Maha Mangala Sutta and many other places.

My first point is: If we abandon bad friends, how will they improve? What role compassion plays here? 

My second point is: It is very hard these days to completely abandon bad friends, we have social networks, professional networks, smartphones etc., we are connected like never before, it is very hard for a lay person to live only with good friends around, except if maybe he/she becomes a recluse, so what should one do? Just set limits?