I have a numpy array which I wish to filter by datetime. I have current functionality to compare an input datetime (start and end) to the dataframe like so:
    if trim:
        columns = input_hdf.columns.get_level_values(0)
        print(str(columns))
        print(start)
        print(end)
        if start is not None and end is not None:
            mask = (columns >= start) & (columns <= end)
        elif start is not None:
            mask = (columns >= start)
        elif end is not None:
            mask = (columns <= end)
        else:
            # Should never reach this point, but just in case - mask will not affect the data
            mask = True
        input_hdf = input_hdf.loc[:, mask]
However, I'd like to add functionality for start and end to be specified as a "day of year", where the year is irrelevant to the comparison - if the day is later than 1st October then exclude it, be it 2001 or 2021.
I am currently converting an integer value into datetime via:
start = datetime.strptime(start, '%d-%m-%Y') if start else None
Which gives a default year of 1900, which will become part of the comparison.
 
    