-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Datetime dev #87
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
Datetime dev #87
Changes from all commits
e64b6f1
6395979
ab2ac7c
fdb4190
487874a
50261be
d6c63e3
5c16411
53ab0c1
98b4c38
dadf6c2
c3f963e
e24e9d4
4fced4a
8a8a84a
db62c35
29a3ceb
3d8fda5
b90d182
68f1cf2
e164d94
f7ae666
0418574
84e1f7d
6b5a42a
6376ba8
d117335
31056d4
abfec95
e6bffff
8019d91
afe25c1
e9f4e75
2d7d59a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.. _routines.datetime: | ||
|
||
Datetime Support Functions | ||
************************** | ||
|
||
.. currentmodule:: numpy | ||
|
||
Business Day Functions | ||
====================== | ||
|
||
.. currentmodule:: numpy | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
busdaycalendar | ||
is_busday | ||
busday_offset | ||
busday_count | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,7 +233,6 @@ typedef enum { | |
NPY_FR_Y, /* Years */ | ||
NPY_FR_M, /* Months */ | ||
NPY_FR_W, /* Weeks */ | ||
NPY_FR_B, /* Business days (weekdays, doesn't account for holidays) */ | ||
NPY_FR_D, /* Days */ | ||
NPY_FR_h, /* hours */ | ||
NPY_FR_m, /* minutes */ | ||
|
@@ -243,16 +242,16 @@ typedef enum { | |
NPY_FR_ns,/* nanoseconds */ | ||
NPY_FR_ps,/* picoseconds */ | ||
NPY_FR_fs,/* femtoseconds */ | ||
NPY_FR_as /* attoseconds */ | ||
NPY_FR_as,/* attoseconds */ | ||
NPY_FR_GENERIC /* Generic, unbound units, can convert to anything */ | ||
} NPY_DATETIMEUNIT; | ||
|
||
#define NPY_DATETIME_NUMUNITS (NPY_FR_as + 1) | ||
#define NPY_DATETIME_DEFAULTUNIT NPY_FR_us | ||
#define NPY_DATETIME_NUMUNITS (NPY_FR_GENERIC + 1) | ||
#define NPY_DATETIME_DEFAULTUNIT NPY_FR_GENERIC | ||
|
||
#define NPY_STR_Y "Y" | ||
#define NPY_STR_M "M" | ||
#define NPY_STR_W "W" | ||
#define NPY_STR_B "B" | ||
#define NPY_STR_D "D" | ||
#define NPY_STR_h "h" | ||
#define NPY_STR_m "m" | ||
|
@@ -264,6 +263,32 @@ typedef enum { | |
#define NPY_STR_fs "fs" | ||
#define NPY_STR_as "as" | ||
|
||
/* | ||
* Business day conventions for mapping invalid business | ||
* days to valid business days. | ||
*/ | ||
typedef enum { | ||
/* Go forward in time to the following business day. */ | ||
NPY_BUSDAY_FORWARD, | ||
NPY_BUSDAY_FOLLOWING = NPY_BUSDAY_FORWARD, | ||
/* Go backward in time to the preceding business day. */ | ||
NPY_BUSDAY_BACKWARD, | ||
NPY_BUSDAY_PRECEDING = NPY_BUSDAY_BACKWARD, | ||
/* | ||
* Go forward in time to the following business day, unless it | ||
* crosses a month boundary, in which case go backward | ||
*/ | ||
NPY_BUSDAY_MODIFIEDFOLLOWING, | ||
/* | ||
* Go backward in time to the preceding business day, unless it | ||
* crosses a month boundary, in which case go forward. | ||
*/ | ||
NPY_BUSDAY_MODIFIEDPRECEDING, | ||
/* Produce a NaT for non-business days. */ | ||
NPY_BUSDAY_NAT, | ||
/* Raise an exception for non-business days. */ | ||
NPY_BUSDAY_RAISE | ||
} NPY_BUSDAY_ROLL; | ||
|
||
/* | ||
* This is to typedef npy_intp to the appropriate pointer size for | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've moved that into npy_common for the sort library. Looks like I'll need to do some merging ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want to do a relatively invasive header shuffle at some point towards managing future ABI compatibility, we'll have to make sure not to step on each others toes with that. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these go in npy_common.h?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that sounds fine. I'm wanting to rename away from the 'frequency' nomenclature as well.