Skip to content

Add basic datetime functionality #275

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

Merged
merged 8 commits into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions spec/API_specification/dataframe_api/column_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,3 +819,85 @@ def rename(self, name: str) -> Self:
New column - this does not operate in-place.
"""
...


def year(self) -> Self:
"""
Return 'year' component of each element of `Date` and `Datetime` columns.

For example, return 1981 for 1981-01-02T12:34:56.123456.

Return column should be of (signed) integer dtype.
"""
...

def month(self) -> Self:
"""
Return 'month' component of each element of `Date` and `Datetime` columns.

For example, return 1 for 1981-01-02T12:34:56.123456.

Return column should be of integer dtype (signed or unsigned).
"""
...

def day(self) -> Self:
"""
Return 'day' component of each element of `Date` and `Datetime` columns.

For example, return 2 for 1981-01-02T12:34:56.123456.

Return column should be of integer dtype (signed or unsigned).
"""
...

def hour(self) -> Self:
"""
Return 'hour' component of each element of `Date` and `Datetime` columns.

For example, return 12 for 1981-01-02T12:34:56.123456.

Return column should be of integer dtype (signed or unsigned).
"""
...

def minute(self) -> Self:
"""
Return 'minute' component of each element of `Date` and `Datetime` columns.

For example, return 34 for 1981-01-02T12:34:56.123456.

Return column should be of integer dtype (signed or unsigned).
"""
...

def second(self) -> Self:
"""
Return 'second' component of each element of `Date` and `Datetime` columns.

For example, return 56 for 1981-01-02T12:34:56.123456.

Return column should be of integer dtype (signed or unsigned).
"""
...

def microsecond(self) -> Self:
"""
Return number of microseconds since last second, for each element of `Date` and `Datetime` columns.

For example, return 123456 for 1981-01-02T12:34:56.123456.

Return column should be of integer dtype (signed or unsigned).
"""
...

def iso_weekday(self) -> Self:
"""
Return ISO weekday for each element of `Date` and `Datetime` columns.

Note that Monday=1, ..., Sunday=7.

Return column should be of integer dtype (signed or unsigned).
"""
...