Skip to content

Commit 32bc3de

Browse files
committed
Revert "API: decimal nan is na"
This reverts commit 967c674.
1 parent f6aa4b9 commit 32bc3de

File tree

3 files changed

+0
-44
lines changed

3 files changed

+0
-44
lines changed

doc/source/whatsnew/v0.24.0.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,6 @@ Missing
12291229
- Bug in :func:`Series.hasnans` that could be incorrectly cached and return incorrect answers if null elements are introduced after an initial call (:issue:`19700`)
12301230
- :func:`Series.isin` now treats all NaN-floats as equal also for `np.object`-dtype. This behavior is consistent with the behavior for float64 (:issue:`22119`)
12311231
- :func:`unique` no longer mangles NaN-floats and the ``NaT``-object for `np.object`-dtype, i.e. ``NaT`` is no longer coerced to a NaN-value and is treated as a different entity. (:issue:`22295`)
1232-
- :meth:`isna` now considers ``decimal.Decimal('NaN')`` a missing value (:issue:`23284`).
12331232

12341233

12351234
MultiIndex

pandas/_libs/missing.pyx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22

33
import cython
4-
import decimal
54
from cython import Py_ssize_t
65

76
import numpy as np
@@ -34,8 +33,6 @@ cdef inline bint _check_all_nulls(object val):
3433
res = get_datetime64_value(val) == NPY_NAT
3534
elif util.is_timedelta64_object(val):
3635
res = get_timedelta64_value(val) == NPY_NAT
37-
elif isinstance(val, decimal.Decimal):
38-
return val.is_nan()
3936
else:
4037
res = 0
4138
return res
@@ -74,8 +71,6 @@ cpdef bint checknull(object val):
7471
return get_timedelta64_value(val) == NPY_NAT
7572
elif util.is_array(val):
7673
return False
77-
elif isinstance(val, decimal.Decimal):
78-
return val.is_nan()
7974
else:
8075
return val is None or util.is_nan(val)
8176

pandas/tests/dtypes/test_missing.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22

3-
import decimal
43
import pytest
54
from warnings import catch_warnings, simplefilter
65
import numpy as np
@@ -249,43 +248,6 @@ def test_period(self):
249248
tm.assert_series_equal(isna(s), exp)
250249
tm.assert_series_equal(notna(s), ~exp)
251250

252-
def test_decimal(self):
253-
# scalars
254-
a = decimal.Decimal(1.0)
255-
assert pd.isna(a) is False
256-
assert pd.notna(a) is True
257-
258-
b = decimal.Decimal('NaN')
259-
assert pd.isna(b) is True
260-
assert pd.notna(b) is False
261-
262-
# array
263-
arr = np.array([a, b])
264-
expected = np.array([False, True])
265-
result = pd.isna(arr)
266-
tm.assert_numpy_array_equal(result, expected)
267-
268-
result = pd.notna(arr)
269-
tm.assert_numpy_array_equal(result, ~expected)
270-
271-
# series
272-
ser = pd.Series(arr)
273-
expected = pd.Series(expected)
274-
result = pd.isna(ser)
275-
tm.assert_series_equal(result, expected)
276-
277-
result = pd.notna(ser)
278-
tm.assert_series_equal(result, ~expected)
279-
280-
# index
281-
idx = pd.Index(arr)
282-
expected = np.array([False, True])
283-
result = pd.isna(idx)
284-
tm.assert_numpy_array_equal(result, expected)
285-
286-
result = pd.notna(idx)
287-
tm.assert_numpy_array_equal(result, ~expected)
288-
289251

290252
def test_array_equivalent():
291253
assert array_equivalent(np.array([np.nan, np.nan]),

0 commit comments

Comments
 (0)