import csv
from datetime import datetime


def get_datemapped_rows(csvfile):
    """
    Returns a list of tuples containing the date of each job_listing along with its row number.
    The dates in the csv are expected to be of the "YYYY-MM-DD" format.
    """
    csvfile.seek(0)
    csvreader = csv.reader(csvfile, delimiter=',')
    date_map = []
    row_number = 0
    for row in csvreader:
        if row[4] != 'date':
            date_map.append(
                (datetime.strptime(row[4], '%Y-%m-%d'), row_number))
        row_number += 1
    csvfile.seek(0)
    return date_map