use mapPartitionsWithIndex to filter out the header