def onlyNormalHours(data, normal_hours):
    """
    This function takes in the data, and only spits out the data that falls under normal trading hours.

    Parameters
    ----------
    data : DataFrame
        dataframe of the stock data.
    normal_hours : list
        list containing the opening hour and closing hour of the market in datetime.

    Returns
    -------
    data : DataFrame
        the dataframe passed in, but without after hours data.

    """
    discard_pile = []
    for r in range(data.shape[0]):
        #rewriting the normal hours so it is current with the day of the current row in the dataframe
        normal_hours[0] = normal_hours[0].replace(year=data['Date'][r].year, month=data['Date'][r].month,
                                               day = data['Date'][r].day)
        normal_hours[1] = normal_hours[1].replace(year=data['Date'][r].year, month=data['Date'][r].month,
                                               day = data['Date'][r].day)

        #comparing the current row to see if it's within normal trading hours - if so then keep, otherwise add the index to a discard pile
        if not(normal_hours[0] <= data['Date'][r] <= normal_hours[1]):
            discard_pile.append(r)
    #now that the non trading hours rows have been recorded, drop them all
    data = data.drop(discard_pile)
    #reindex the dataframe so the indeces are sequential again
    data = data.reset_index(drop=True)
    
    return data