Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit e7b75ff

Browse files
authored
bool for series isna (#586)
1 parent f78c4b2 commit e7b75ff

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

sdc/datatypes/hpat_pandas_series_functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ def hpat_pandas_series_isnull(self):
23952395
ty_checker = TypeChecker(_func_name)
23962396
ty_checker.check(self, SeriesType)
23972397

2398-
if isinstance(self.data.dtype, (types.Integer, types.Float)):
2398+
if isinstance(self.data.dtype, (types.Number, types.Boolean, bool)):
23992399
def hpat_pandas_series_isnull_impl(self):
24002400
return pandas.Series(data=numpy.isnan(self._data), index=self._index, name=self._name)
24012401

@@ -2463,7 +2463,7 @@ def hpat_pandas_series_isna(self):
24632463
ty_checker = TypeChecker(_func_name)
24642464
ty_checker.check(self, SeriesType)
24652465

2466-
if isinstance(self.data.dtype, (types.Integer, types.Float)):
2466+
if isinstance(self.data.dtype, (types.Number, types.Boolean, bool)):
24672467
def hpat_pandas_series_isna_impl(self):
24682468
return pandas.Series(data=numpy.isnan(self._data), index=self._index, name=self._name)
24692469

@@ -2531,7 +2531,7 @@ def hpat_pandas_series_notna(self):
25312531
ty_checker = TypeChecker(_func_name)
25322532
ty_checker.check(self, SeriesType)
25332533

2534-
if isinstance(self.data.dtype, types.Number):
2534+
if isinstance(self.data.dtype, (types.Number, types.Boolean, bool)):
25352535
def hpat_pandas_series_notna_impl(self):
25362536
return pandas.Series(numpy.invert(numpy.isnan(self._data)), index=self._index, name=self._name)
25372537

sdc/functions/numpy_like.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def sdc_copy_string_impl(self):
163163

164164

165165
@sdc_overload(notnan)
166-
def sdc_isnan_overload(self):
166+
def sdc_notnan_overload(self):
167167
"""
168168
Intel Scalable Dataframe Compiler Developer Guide
169169
*************************************************
@@ -177,7 +177,7 @@ def sdc_isnan_overload(self):
177177

178178
dtype = self.dtype
179179
isnan = get_isnan(dtype)
180-
if isinstance(dtype, types.Integer):
180+
if isinstance(dtype, (types.Integer, types.Boolean, bool)):
181181
def sdc_notnan_int_impl(self):
182182
length = len(self)
183183
res = numpy.ones(shape=length, dtype=numpy.bool_)
@@ -215,7 +215,7 @@ def sdc_isnan_overload(self):
215215

216216
dtype = self.dtype
217217
isnan = get_isnan(dtype)
218-
if isinstance(dtype, types.Integer):
218+
if isinstance(dtype, (types.Integer, types.Boolean, bool)):
219219
def sdc_isnan_int_impl(self):
220220
length = len(self)
221221
res = numpy.zeros(shape=length, dtype=numpy.bool_)

sdc/tests/test_series.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3582,7 +3582,7 @@ def test_impl(S):
35823582

35833583
jit_func = self.jit(test_impl)
35843584

3585-
datas = [[0, 1, 2, 3], [0., 1., np.inf, np.nan], ['a', None, 'b', 'c']]
3585+
datas = [[0, 1, 2, 3], [0., 1., np.inf, np.nan], ['a', None, 'b', 'c'], [True, True, False, False]]
35863586
indices = [None, [3, 2, 1, 0], ['a', 'b', 'c', 'd']]
35873587
names = [None, 'A']
35883588

@@ -3600,7 +3600,7 @@ def test_impl(S):
36003600

36013601
jit_func = self.jit(test_impl)
36023602

3603-
datas = [[0, 1, 2, 3], [0., 1., np.inf, np.nan], ['a', None, 'b', 'c']]
3603+
datas = [[0, 1, 2, 3], [0., 1., np.inf, np.nan], ['a', None, 'b', 'c'], [True, True, False, False]]
36043604
indices = [None, [3, 2, 1, 0], ['a', 'b', 'c', 'd']]
36053605
names = [None, 'A']
36063606

@@ -3626,7 +3626,7 @@ def test_impl(S):
36263626

36273627
jit_func = self.jit(test_impl)
36283628

3629-
datas = [[0, 1, 2, 3], [0., 1., np.inf, np.nan], ['a', None, 'b', 'c']]
3629+
datas = [[0, 1, 2, 3], [0., 1., np.inf, np.nan], ['a', None, 'b', 'c'], [True, True, False, False]]
36303630
indices = [None, [3, 2, 1, 0], ['a', 'b', 'c', 'd']]
36313631
names = [None, 'A']
36323632

0 commit comments

Comments
 (0)