A judge in Uttar Pradesh who handed down 23 death sentences in six months has been transferred to a family court.