Over 3,000 pupils in Edinburgh missed more than half the school year last year, new figures have revealed.