10000 impl loc callable by 1e-to · Pull Request #501 · IntelPython/sdc · GitHub
[go: up one dir, main page]

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

impl loc callable #501

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
small fixes
  • Loading branch information
elena.totmenina committed Jan 15, 2020
commit c6acb1351604591d64f2d5d7b1789d8931541390
4 changes: 2 additions & 2 deletions sdc/datatypes/hpat_pandas_series_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def hpat_pandas_series_loc_callable_impl(self, idx):

return hpat_pandas_series_loc_callable_impl

raise TypingError('{} The index must be an Number, Slice, String, List, Array or a callable.\
Given: {}'.format(_func_name, idx))
raise TypingError('{} The index must be an Number, Slice, String, List, Array or a callable.\
Given: {}'.format(_func_name, idx))

if accessor == 'at':
if isinstance(idx, (int, types.Integer, types.UnicodeType, types.StringLiteral)):
Expand Down
7 changes: 4 additions & 3 deletions sdc/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,15 +1261,16 @@ def test_impl(A):
@skip_sdc_jit('Not impl in old style')
def test_series_loc_callable(self):
def test_impl(S):
return S.loc[(lambda a: a)]
return S.loc[lambda a: a ** 2]
hpat_func = self.jit(test_impl)
S = pd.Series([0, 6, 4, 7, 8], [0, 6, 66, 6, 8])
pd.testing.assert_series_equal(hpat_func(S), test_impl(S))

@unittest.skip('Loc callable return float Series')
# Loc callable return float Series
@unittest.expectedFailure
def test_series_loc_callable2(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about merging of test_series_loc_callable and test_series_loc_callable2?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because implementation has limit and always return float Series. In that case pandas return int Series, and we return float Series. I wrote about it in notes in loc.
Test skips with expected failure

def test_impl(S):
return S.loc[(lambda a: a)]
return S.loc[lambda a: a]
hpat_func = self.jit(test_impl)
S = pd.Series([0, 6, 8, 8, 8], [0, 6, 66, 6, 8])
pd.testing.assert_series_equal(hpat_func(S), test_impl(S))
Expand Down
0