Closed
Description
These names exist already in pd.tslib
(as the below weedays calc), should just create them as a variable so can import it directly here.
In [1]: import calendar
In [25]: s = pd.Series(list(range(10)), pd.date_range('2015-09-01', '2015-09-10'))
In [26]: s2 = s.to_frame('value').assign(weekday=Series(s.index.weekday).map(Series(weekdays)).values)
In [27]: weekdays = [calendar.day_name[i].lower() for i in range(7)]
In [28]: s2 = s.to_frame('value').assign(weekday=Series(s.index.weekday).map(Series(weekdays)).values)
In [29]: s2
Out[29]:
value weekday
2015-09-01 0 tuesday
2015-09-02 1 wednesday
2015-09-03 2 thursday
2015-09-04 3 friday
2015-09-05 4 saturday
2015-09-06 5 sunday
2015-09-07 6 monday
2015-09-08 7 tuesday
2015-09-09 8 wednesday
2015-09-10 9 thursday