-
Notifications
You must be signed in to change notification settings - Fork 61
Implemented iterator for pandas.Series #125
Conversation
hpat/tests/test_series.py
Outdated
@@ -1485,6 +1485,30 @@ def test_impl(): | |||
hpat_func = hpat.jit(test_impl) | |||
np.testing.assert_array_equal(hpat_func(), test_impl()) | |||
|
|||
def test_series_iterator_int(self): | |||
def test_impl(): | |||
A = pd.Series([1, 2, 3, 4, 5]) |
There was a problem hiding this comment.
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 constructing Series with unsorted list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akharche Should we add tests with other types, like float and boolean as well? Will they be handled correctly now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@densmirn I think, it doesn't matter in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kozlov-alexey Yes, I am going to add by the next commit
hpat_func = hpat.jit(test_impl) | ||
np.testing.assert_array_equal(hpat_func(), test_impl()) | ||
|
||
def test_series_iterator_one_value(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to add something like:
def test_series_iterator_one_value(self):
def test_impl(A):
return [i for i in A]
A = pd.Series([5])
hpat_func = hpat.jit(test_impl)
np.testing.assert_array_equal(hpat_func(A), test_impl(A))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akharche We may also check that empty series is handled correctly, by supplying
A = pd.Series([np.int64(x) for x in range(0)])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shssf I think yes, it is also important to check iteration over Series as a parameter. I will add this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kozlov-alexey Yes, I will add
@akharche Did you look for a code style for this by |
@shssf Code style checks are ok for the changes |
@akharche Is this PR ready to merge? |
* Implemented iterator for pandas.Series * Add tests * Fixed tests to run with mpi on 2 and more processes
The first version of iterator for pandas.Series type: