Skip to content

Datetime fixes #83

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 39 commits into from
Jun 7, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
25bcc65
ENH: Small changes towards datetime type promotion
May 19, 2011
7045cbc
ENH: Reimplement datetime dtype string parser (with error checking)
May 19, 2011
8949fe2
ENH: Tighten up dtype parsing in general, to catch some more invalid …
May 20, 2011
6ab9c73
ENH: Start implementing the datetime type promotion rules, clean up d…
May 20, 2011
8727a80
ENH: Remove 'den' datetime metadata, move datetime_data to a C function
May 20, 2011
19b71ad
ENH: promote_types applies the datetime promotion rules
May 20, 2011
77b9d3e
BUG: Restore pickling functionality, incorporate Chuck's feedback
May 23, 2011
44855ca
ENH: Wrote (close to an) ISO date parser, partially modified TIMEVALU…
May 23, 2011
442096d
ENH: Got the ISO date parser working in DATETIME_setitem
May 23, 2011
81c37aa
ENH: Refactor datetime conversion from PyObject* into its own function
May 24, 2011
6d960a6
BUG: Was incorrectly using month and day in npy_datetimestruct
May 24, 2011
feb6c2c
ENH: Refactored DATETIME_getitem and the function it calls
May 24, 2011
6b8ad91
ENH: Cleaning up object <-> datetime conversions
May 25, 2011
a106c29
ENH: datetime: Tests and fixes for datetime64 <-> object roundtripping
May 25, 2011
a12f0d1
ENH: Generalize ufunc type resolution to be a replaceable function
May 25, 2011
3729edf
ENH: umath: Add a binary comparison type resolution function
May 26, 2011
5bb9157
ENH: ufunc: Hook up the binary comparison type resolution
May 26, 2011
cbfec87
ENH: datetime: Some work towards getting datetime casting between uni…
May 26, 2011
3456676
BUG: Fix datetime metadata comparison
May 26, 2011
4f2a2d9
ENH: datetime: Got datetime interunit comparisons working
May 27, 2011
cb21fd9
ENH: Create type resolution function for 'add' with special datetime …
May 27, 2011
9f2b299
ENH: Add custom type resolution function for the subtract ufunc with …
May 27, 2011
7fa5c2a
ENH: Add ufunc datetime-aware type resolution functions for multiply …
May 27, 2011
a3a4e5a
ENH: datetime: Implement the multiply and divide DATETIME ufunc loops
May 31, 2011
7444e85
ENH: datetime: Add min/max type resolution, implement tests for datet…
May 31, 2011
da6391a
ENH: Handle NaT in most operations, some progress towards proper cast…
May 31, 2011
33babc9
ENH: datetime: Add more tests and type resolution for datetime
Jun 1, 2011
3dd1018
ENH: datetime: Remove logical operations from timedelta
Jun 1, 2011
653c645
ENH: Remove dead code in PyArray_SetDatetimeParseFunction
Jun 1, 2011
7eb97b5
ENH: datetime: Allow metadata parameter in datetime scalar constructors
Jun 1, 2011
b0a6e39
ENH: datetime: Fix up creation of datetime scalar
Jun 2, 2011
f2d9812
ENH: datetime: Generalize the unit parser so datetime scalar can take…
Jun 2, 2011
13bafaa
TST: datetime: Extend the tests for the NumPy scalars as well
Jun 2, 2011
e08fbd0
ENH: datetime: Add timedelta -> timedelta scalar casting
Jun 2, 2011
6c2c90c
ENH: datetime: Eliminate use of npy_timedeltastruct, an unnecessary a…
Jun 2, 2011
8f35cd7
WRN: Eliminate a number of compiler warnings
Jun 2, 2011
681adf0
ENH: datetime: Got repr and str for datetime scalars working
Jun 3, 2011
de71993
ENH: datetime: Remove TimeInteger, partially fix up datetime array pr…
Jun 3, 2011
283b2e7
ENH: datetime: Finish fixing up datetime printing, add datetime to st…
Jun 3, 2011
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
30 changes: 0 additions & 30 deletions numpy/core/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,36 +166,6 @@ def _split(input):

return newlist

format_datetime = re.compile(asbytes(r"""
(?P<typecode>M8|m8|datetime64|timedelta64)
([[]
((?P<num>\d+)?
(?P<baseunit>Y|M|W|B|D|h|m|s|ms|us|ns|ps|fs|as)
(/(?P<den>\d+))?
[]])
(//(?P<events>\d+))?)?"""), re.X)

# Return (baseunit, num, den, events), datetime
# from date-time string
def _datetimestring(astr):
res = format_datetime.match(astr)
if res is None:
raise ValueError("Incorrect date-time string.")
typecode = res.group('typecode')
datetime = (typecode == asbytes('M8') or typecode == asbytes('datetime64'))
defaults = [asbytes('us'), 1, 1, 1]
names = ['baseunit', 'num', 'den', 'events']
func = [bytes, int, int, int]
dt_tuple = []
for i, name in enumerate(names):
value = res.group(name)
if value:
dt_tuple.append(func[i](value))
else:
dt_tuple.append(defaults[i])

return tuple(dt_tuple), datetime

format_re = re.compile(asbytes(r'(?P<order1>[<>|=]?)(?P<repeats> *[(]?[ ,0-9]*[)]? *)(?P<order2>[<>|=]?)(?P<dtype>[A-Za-z0-9.]*)'))

# astr is a string (perhaps comma separated)
Expand Down
Loading