You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2021/06/09 17:29:00 UTC
[jira] [Resolved] (ARROW-11759) [C++] Kernel to extract datetime
components (year, month, day, etc) from timestamp type
[ https://issues.apache.org/jira/browse/ARROW-11759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antoine Pitrou resolved ARROW-11759.
------------------------------------
Fix Version/s: 5.0.0
Resolution: Fixed
Issue resolved by pull request 10176
[https://github.com/apache/arrow/pull/10176]
> [C++] Kernel to extract datetime components (year, month, day, etc) from timestamp type
> ---------------------------------------------------------------------------------------
>
> Key: ARROW-11759
> URL: https://issues.apache.org/jira/browse/ARROW-11759
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Reporter: Joris Van den Bossche
> Assignee: Rok Mihevc
> Priority: Major
> Labels: pull-request-available
> Fix For: 5.0.0
>
> Time Spent: 18h 10m
> Remaining Estimate: 0h
>
> It can be very useful to extract certain "fields" from the timestamp, such as the year, month, day, etc.
> See eg https://pandas.pydata.org/docs/user_guide/timeseries.html#time-date-components for the ones available in pandas.
> Using pandas as an example, there are the basic components of the datetime:
> {code}
> >>> ts = pd.Timestamp.now()
> >>> ts
> Timestamp('2021-02-24 10:47:54.294504')
> >>> ts.year
> 2021
> >>> ts.month
> 2
> >>> ts.day
> 24
> >>> ts.hour
> 10
> >>> ts.minute
> 49
> >>> ts.second
> 54
> >>> ts.microsecond
> 607393
> >>> ts.nanosecond
> 0
> {code}
> (only for the sub-second, this is not fully clear how to divide it in microseconds or milliseconds, etc)
> But in addition also some more "advanced" like:
> {code}
> >>> ts.dayofyear
> 55
> >>> ts.dayofweek
> 2
> >>> ts.week
> 8
> >>> ts.isocalendar()
> (2021, 8, 3)
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)