Skip to content

ENH: add weekday_name to DatetimeIndex and .dt #11128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jreback opened this issue Sep 16, 2015 · 5 comments
Closed

ENH: add weekday_name to DatetimeIndex and .dt #11128

jreback opened this issue Sep 16, 2015 · 5 comments
Labels
Datetime Datetime data dtype Enhancement
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Sep 16, 2015

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
@jreback jreback added this to the Next Major Release milestone Sep 16, 2015
@jreback jreback changed the title ENH: add weekday_name to DatetimeIndex and .dt ENH: add weekday_name to DatetimeIndex and .dt Sep 16, 2015
@jreback jreback modified the milestones: 0.18.0, Next Major Release Dec 10, 2015
@jreback jreback modified the milestones: Next Major Release, 0.18.0 Feb 2, 2016
@BastiaanBergman
Copy link

So this is closed with the fix proposed in #11813, no?

@jreback
Copy link
Contributor Author

jreback commented Mar 30, 2016

@BastiaanBergman it would be, but that has not been merged (its ok PR, just needs some updates). want to pick it up?

@BastiaanBergman
Copy link

I'll give it a try.

@BastiaanBergman
Copy link

What about the class LocaleTime in tslib.pyx, is that initiated and used anywhere?

@jreback
Copy link
Contributor Author

jreback commented Apr 4, 2016

it used only in regex parsing of formatting string. e.g. the format= arg in pd.to_datetime(...). It could be used here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Enhancement
Projects
None yet
2 participants