Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add comment in skip test, some change in impl
  • Loading branch information
Rubtsowa committed May 26, 2020
commit 6f37f53f7ea54006e4aa0723bec063b0b1256e2d
12 changes: 6 additions & 6 deletions sdc/datatypes/hpat_pandas_series_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4956,17 +4956,17 @@ def sdc_pandas_series_combine_impl(self, other, func, fill_value=None):
for i in prange(len(chunks)):
chunk = chunks[i]
for j in range(chunk.start, chunk.stop):
if self_indexes[j] == -1:
self_idx = self_indexes[j]
if self_idx == -1:
val_self = _fill_value
else:
ind_self = self_indexes[j]
val_self = self[ind_self]._data[0]
val_self = self[self_idx]._data[0]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

self_idx (and other_idx) is position in the Series, not the index, so instead of using getitem on a Series, that performs index lookup and returns a Series, so that you have to take _data[0] from it, you can just write:

Suggested change
val_self = self[self_idx]._data[0]
val_self = self._data[self_idx]


if other_indexes[j] == -1:
other_idx = other_indexes[j]
if other_idx == -1:
val_other = _fill_value
else:
ind_other = other_indexes[j]
val_other = other[ind_other]._data[0]
val_other = other[other_idx]._data[0]

result[j] = func(val_self, val_other)
return pandas.Series(result, index=indexes)
Expand Down
2 changes: 2 additions & 0 deletions sdc/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2819,6 +2819,8 @@ def test_impl(S1, S2):

@unittest.expectedFailure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add comment why the test is skipped.
@unittest.expectedFailure # ...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Rubtsowa No need to skip the test if that's how impl is intended to work. Use check_dtype=False in assert_series_equal and add a comment just before this check to refer to SDC Limitation.

def test_series_combine_integer_samelen(self):
"""Result series type `int` is expected,
`float` is returned since this is the default fill_value type"""
def test_impl(S1, S2):
return S1.combine(S2, lambda a, b: 2 * a + b)
hpat_func = self.jit(test_impl)
Expand Down