8000 Implement npy_dtime.pyx by jbrockmendel · Pull Request #17805 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Implement npy_dtime.pyx #17805

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 17 commits into from
Oct 29, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
re-privatize _check_dts_bounds
  • Loading branch information
jbrockmendel committed Oct 23, 2017
commit c0b399ed1882bbbe7c84c8061586c5c98301322a
2 changes: 1 addition & 1 deletion pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ from datetime cimport (
from datetime import timedelta, datetime
from datetime import time as datetime_time

from tslibs.np_datetime cimport check_dts_bounds as _check_dts_bounds
from tslibs.np_datetime cimport _check_dts_bounds
from tslibs.np_datetime import OutOfBoundsDatetime

from khash cimport (
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/np_datetime.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cdef extern from "../src/datetime/np_datetime.h":
int32_t month, day, hour, min, sec, us, ps, as


cdef check_dts_bounds(pandas_datetimestruct *dts)
cdef _check_dts_bounds(pandas_datetimestruct *dts)

cdef int64_t dtstruct_to_dt64(pandas_datetimestruct* dts) nogil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where these nogil before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analogous src/datetime functions are, yes.

cdef void dt64_to_dtstruct(int64_t dt64, pandas_datetimestruct* out) nogil
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/np_datetime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class OutOfBoundsDatetime(ValueError):
pass


cdef inline check_dts_bounds(pandas_datetimestruct *dts):
cdef inline _check_dts_bounds(pandas_datetimestruct *dts):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this should be de-privatized

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to do it since that's how it was before: #17805 (comment)

"""Returns True if an error needs to be raised"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a doc-string, and change this (which is wrong), it will just raise if there is an oob date

cdef:
bint error = False
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/strptime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ from numpy cimport ndarray, int64_t
from datetime import date as datetime_date
from datetime cimport datetime

from np_datetime cimport (check_dts_bounds,
from np_datetime cimport (_check_dts_bounds,
dtstruct_to_dt64, pandas_datetimestruct)

from u 62E6 til cimport is_string_object, get_nat
Expand Down Expand Up @@ -331,7 +331,7 @@ def array_strptime(ndarray[object] values, object fmt,

iresult[i] = dtstruct_to_dt64(&dts)
try:
check_dts_bounds(&dts)
_check_dts_bounds(&dts)
except ValueError:
if is_coerce:
iresult[i] = NPY_NAT
Expand Down
0