Skip to content
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 from
Closed

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented Jun 20, 2017

closes #306

@cpcloud cpcloud self-assigned this Jun 20, 2017
@cpcloud cpcloud added feature Features or general enhancements expressions Issues or PRs related to the expression API labels Jun 20, 2017
@cpcloud cpcloud added this to the 0.11 milestone Jun 20, 2017
@cpcloud
Copy link
Member Author

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
Copy link
Contributor

jreback commented Jun 20, 2017

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

@cpcloud
Copy link
Member Author

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 day-of-week branch 5 times, most recently from 469d986 to 14e6746 Compare October 27, 2017 15:49
@cpcloud cpcloud force-pushed the day-of-week branch 2 times, most recently from bc0f04b to 86fcee5 Compare November 12, 2017 16:29
@cpcloud cpcloud force-pushed the day-of-week branch 2 times, most recently from e3f59b6 to eac17c2 Compare February 6, 2018 16:42
@cpcloud
Copy link
Member Author

cpcloud commented Feb 9, 2018

Merging on green.

@cpcloud cpcloud closed this in c34886d Feb 9, 2018
@cpcloud cpcloud deleted the day-of-week branch February 9, 2018 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expressions Issues or PRs related to the expression API feature Features or general enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Day of week API for timestamp values
2 participants