Pythonic way to do strategy design pattern,avoid use switch base on string compare
Yes. The most flexible approach would use getattr.

def extract(attr, datetimeindex):
    return [getattr(x, attr) for x in datetimeindex]

# Now, for example:
extract_day_of_year = partial(extract, attr='dayofyear')

# or
def extract_day_of_month(datetimeindex):
    return extract('dayofmonth', datetimeindex)


Alternatively with attrgetter:

def extract(attr, datetimeindex):
    return map(attrgetter(attr), datetimeindex)


I've also converted the for loop into a list comprehension (first) or map() (second), both of which spare you from needing to name a temporary variable.