def __call__(self, row):
        "Extract specified part of date from column in row."
        date = row[self.__column]
        if self.__part == 'Y':
            return date.year
        if self.__part == 'Q':
            return (date.month - 1) // 3 + 1
        if self.__part == 'M':
            return date.month
        if self.__part == 'D':
            return date.month
        raise ValueError('DatePart code cannot be processed!')
Extract specified part of date from column in row.
recipes/Python/577825_Rudimentary_Database_Engine/recipe-577825.py