Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
5 changes: 3 additions & 2 deletions pandas/_libs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ from pandas._libs import tslib
from pandas._libs.tslib import Timestamp, iNaT, NaT
from tslibs.timezones cimport (
is_utc, is_tzlocal, get_utcoffset, get_dst_info, maybe_get_tz)
from tslib cimport _nat_scalar_rules

from tslibs.parsing import parse_time_string, NAT_SENTINEL
from tslibs.frequencies cimport get_freq_code
from tslibs.nattype import nat_strings
from tslibs.nattype cimport _nat_scalar_rules
Copy link
Contributor

Choose a reason for hiding this comment

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

in followup I could de-privatize this _nat_scalar_rules)

Copy link
Member Author

Choose a reason for hiding this comment

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

That works. I'm also ok with getting rid of it, since op != Py_NE is pretty easy.


from pandas.tseries import offsets
from pandas.tseries import frequencies
Expand Down Expand Up @@ -1185,7 +1186,7 @@ class Period(_Period):
converted = other.asfreq(freq)
ordinal = converted.ordinal

elif is_null_datetimelike(value) or value in tslib._nat_strings:
elif is_null_datetimelike(value) or value in nat_strings:
ordinal = iNaT

elif is_string_object(value) or util.is_integer_object(value):
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/src/inference.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sys
from decimal import Decimal
cimport util
cimport cython
from tslib import NaT
from tslibs.nattype import NaT
from tslibs.timezones cimport get_timezone
from datetime import datetime, timedelta
iNaT = util.get_nat()
Expand Down
11 changes: 6 additions & 5 deletions pandas/_libs/src/ujson/python/objToJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void initObjToJSON(void)
#endif
{
PyObject *mod_pandas;
PyObject *mod_tslib;
PyObject *mod_nattype;
PyObject *mod_decimal = PyImport_ImportModule("decimal");
type_decimal = PyObject_GetAttrString(mod_decimal, "Decimal");
Py_INCREF(type_decimal);
Expand All @@ -180,10 +180,11 @@ void initObjToJSON(void)
Py_DECREF(mod_pandas);
}

mod_tslib = PyImport_ImportModule("pandas._libs.tslib");
if (mod_tslib) {
cls_nat = (PyTypeObject *)PyObject_GetAttrString(mod_tslib, "NaTType");
Py_DECREF(mod_tslib);
mod_nattype = PyImport_ImportModule("pandas._libs.tslibs.nattype");
if (mod_nattype) {
cls_nat = (PyTypeObject *)PyObject_GetAttrString(mod_nattype,
"NaTType");
Py_DECREF(mod_nattype);
}

/* Initialise numpy API and use 2/3 compatible return */
Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/tslib.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ from numpy cimport ndarray, int64_t

cdef convert_to_tsobject(object, object, object, bint, bint)
cpdef convert_to_timedelta64(object, object)
cdef bint _nat_scalar_rules[6]
cdef bint _check_all_nulls(obj)

cdef _to_i8(object val)
Loading