How to pass many ids in post__in?

Don’t concatenate your id values into a comma separate string otherwise you will have to explode() by comma delimiter which is pointless, instead, if you are getting IDs from some other business logic as evidenced in your iteration over $rows, then build an array of IDs as per the following example:

$ids = array();

foreach ($rows as $obj) {
    $ids[] = $obj->ID;
}

$args = array (
     'post_type' => 'professores',
     'post__in'  => $ids
);