Skip to content

Commit 802e27c

Browse files
committed
changed all na to np.nan
1 parent 8a1ca26 commit 802e27c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pandas/_libs/tslibs/strptime.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def array_strptime(ndarray[object] values, object fmt, bint exact=True, errors='
134134
iresult[i] = NPY_NAT
135135
continue
136136
else:
137-
if checknull_with_nat(val) or val.__repr__() == "<NA>":
137+
if checknull_with_nat(val):
138138
iresult[i] = NPY_NAT
139139
continue
140140
else:

pandas/core/tools/datetimes.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
ABCDataFrame,
5757
ABCSeries,
5858
)
59-
from pandas.core.dtypes.missing import notna
59+
from pandas.core.dtypes.missing import (
60+
isna,
61+
notna,
62+
)
6063

6164
from pandas.arrays import (
6265
DatetimeArray,
@@ -496,6 +499,8 @@ def _to_datetime_with_format(
496499
utc = tz == "utc"
497500
return _box_as_indexlike(result, utc=utc, name=name)
498501

502+
# GH#42957 #replacing all na with np.nan
503+
arg[isna(arg)] = np.nan
499504
# fallback
500505
res = _array_strptime_with_fallback(
501506
arg, name, tz, fmt, exact, errors, infer_datetime_format

0 commit comments

Comments
 (0)