Skip to content

Remove unused tslib function #58198

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 1 commit into from
Apr 9, 2024
Merged
Changes from all 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
34 changes: 0 additions & 34 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ from pandas._libs.tslibs.conversion cimport (
from pandas._libs.tslibs.dtypes cimport npy_unit_to_abbrev
from pandas._libs.tslibs.nattype cimport (
NPY_NAT,
c_NaT as NaT,
c_nat_strings as nat_strings,
)
from pandas._libs.tslibs.timestamps cimport _Timestamp
Expand Down Expand Up @@ -346,39 +345,6 @@ def array_with_unit_to_datetime(
return result, tz


cdef _array_with_unit_to_datetime_object_fallback(ndarray[object] values, str unit):
cdef:
Py_ssize_t i, n = len(values)
ndarray[object] oresult
tzinfo tz = None

# TODO: fix subtle differences between this and no-unit code
oresult = cnp.PyArray_EMPTY(values.ndim, values.shape, cnp.NPY_OBJECT, 0)
for i in range(n):
val = values[i]

if checknull_with_nat_and_na(val):
oresult[i] = <object>NaT
elif is_integer_object(val) or is_float_object(val):

if val != val or val == NPY_NAT:
oresult[i] = <object>NaT
else:
try:
oresult[i] = Timestamp(val, unit=unit)
except OutOfBoundsDatetime:
oresult[i] = val

elif isinstance(val, str):
if len(val) == 0 or val in nat_strings:
oresult[i] = <object>NaT

else:
oresult[i] = val

return oresult, tz


@cython.wraparound(False)
@cython.boundscheck(False)
def first_non_null(values: ndarray) -> int:
Expand Down