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

ENH: add weekday_name to DatetimeIndex and .dt #11128

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

Comments

Projects
None yet
2 participants
@jreback
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 from ENH: add weekday_name to ``DatetimeIndex`` and ``.dt`` to 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

This comment has been minimized.

Show comment
Hide comment
@BastiaanBergman

BastiaanBergman Mar 30, 2016

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

BastiaanBergman commented Mar 30, 2016

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

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Mar 30, 2016

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@BastiaanBergman

BastiaanBergman Mar 30, 2016

I'll give it a try.

BastiaanBergman commented Mar 30, 2016

I'll give it a try.

@BastiaanBergman

This comment has been minimized.

Show comment
Hide comment
@BastiaanBergman

BastiaanBergman Apr 4, 2016

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

BastiaanBergman commented Apr 4, 2016

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

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Apr 4, 2016

Contributor

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

Contributor

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.

@jreback jreback modified the milestones: 0.18.1, Next Major Release Apr 5, 2016

@jreback jreback closed this in afddc4f Apr 26, 2016

nps added a commit to nps/pandas that referenced this issue May 17, 2016

ENH: GH11128 add weekday_name to DatetimeIndex and .dt
closes pandas-dev#11128   replaces pandas-dev#11813     - [x] tests added / passed   - [x]
passes ``git diff upstream/master | flake8 --diff``   - [x] whatsnew
entry    Completed merge of Bahrunnur's PR 'weekday-name'
Moved 'enhancements' to v0.18.1.txt          Added tests to
pandas/tests/series/test_datetime_values.py          Added
weekday_name property producing 'NaT' to NaTType class

Author: Bastiaan <Bastiaan.Bergman@WDC.com>
Author: Bahrunnur <bahrunnur20@gmail.com>

Closes pandas-dev#12803 from BastiaanBergman/ENH11128 and squashes the following commits:

c579d71 [Bastiaan] Tiny fixes as requested by jreback, GH12803.
6f246d5 [Bastiaan] Small fixes as requested by jreback, GH12803.
7b14d5c [Bahrunnur] ENH: GH11128 add weekday_name to DatetimeIndex and .dt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment