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

Add day_of_week* API #1047

Closed
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@cpcloud
Member

cpcloud commented Jun 20, 2017

closes #306

@cpcloud cpcloud self-assigned this Jun 20, 2017

@cpcloud cpcloud added this to the 0.11 milestone Jun 20, 2017

@cpcloud cpcloud force-pushed the cpcloud:day-of-week branch from ce28e7e to 999980b Jun 20, 2017

@cpcloud

This comment has been minimized.

Member

cpcloud commented Jun 20, 2017

@wesm @jreback Curious about your thoughts on the API here.

I've defined

  • day_of_week_index(): the index of the value's day relative to Sunday which starts at 1
  • day_of_week_name(): name of the day of the week

Originally I had day_of_week(name=False) which would return a different type depending on the input, which I thought might be confusing to users. OTOH it does reduce the API surface a tiny bit.

@jreback

This comment has been minimized.

Contributor

jreback commented Jun 20, 2017

maybe have day_of_week be a node which can have index() or name() in it?

@cpcloud cpcloud force-pushed the cpcloud:day-of-week branch from 999980b to adc105b Jun 20, 2017

@cpcloud

This comment has been minimized.

Member

cpcloud commented Jun 20, 2017

Interesting. This could be modeled as a struct<index: int32, name: string> logically.

So for example a user could do the following:

dow = t.date_column.day_of_week()
result = dow.execute()  # this returns a Series of dict

index = dow.index().execute()  # series of int32
name = dow.name().execute()  # series of strings

@cpcloud cpcloud modified the milestones: 0.12, 0.11 Jun 20, 2017

@cpcloud cpcloud force-pushed the cpcloud:day-of-week branch 5 times, most recently from 469d986 to 14e6746 Oct 22, 2017

@cpcloud cpcloud force-pushed the cpcloud:day-of-week branch 2 times, most recently from bc0f04b to 86fcee5 Nov 12, 2017

@cpcloud cpcloud force-pushed the cpcloud:day-of-week branch 2 times, most recently from e3f59b6 to eac17c2 Feb 5, 2018

@cpcloud cpcloud force-pushed the cpcloud:day-of-week branch from eac17c2 to 0eb6868 Feb 9, 2018

@cpcloud

This comment has been minimized.

Member

cpcloud commented Feb 9, 2018

Merging on green.

@cpcloud cpcloud closed this in c34886d Feb 9, 2018

@cpcloud cpcloud deleted the cpcloud:day-of-week branch Feb 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment