-
Notifications
You must be signed in to change notification settings - Fork 61
Conversation
raise TypingError('{} Unsupported parameters. Given {}: {}'.format(_func_name, name, arg)) | ||
|
||
def hpat_pandas_series_std_impl(self, axis=None, skipna=None, level=None, ddof=1, numeric_only=None): | ||
return math.sqrt(self.var(axis=axis, skipna=skipna, level=level, ddof=ddof, numeric_only=numeric_only)) |
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.
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.
Because numpy implementation has ddof=0
by default, but ddof=1
is by default for pandas. Implementation of series.var
takes into account the fact.
hpat/tests/test_series.py
Outdated
msg = 'Method std(). The object must be a number. Given self.dtype: {}' | ||
self.assertIn(msg.format(types.unicode_type), str(raises.exception)) | ||
|
||
def test_series_std_unsupported_axis(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.
Appreciate this, thank you.
Maybe it is better to combine all tests (for this method) for parameters check into one test?
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.
Let me make such change.
def hapt_pandas_series_std(self, axis=None, skipna=None, level=None, ddof=1, numeric_only=None): | ||
""" | ||
Pandas Series method :meth:`pandas.Series.std` implementation. | ||
.. only:: developer |
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.
please insert blank line. Otherwise it will be treated as the same line with above in documentation generator.
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.
Fixed.
Test: python -m hpat.runtests hpat.tests.test_series.TestSeries.test_series_std_unsupported_axis | ||
Test: python -m hpat.runtests hpat.tests.test_series.TestSeries.test_series_std_unsupported_level | ||
Test: python -m hpat.runtests hpat.tests.test_series.TestSeries.test_series_std_unsupported_numeric_only | ||
Parameters |
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.
please insert blank line. Otherwise it will be treated as the same line with above in documentation generator.
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.
Fixed.
If None, will attempt to use everything, then use only numeric data. | ||
Not implemented for Series. | ||
*unsupported* | ||
Returns |
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.
please insert blank line. Otherwise it will be treated as the same line with above in documentation generator.
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.
Fixed.
:obj:`scalar` | ||
returns :obj:`scalar` | ||
""" | ||
_func_name = 'Method std().' |
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.
please insert blank line.
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.
Fixed.
e619946
to
6ddbf0a
Compare
@@ -173,6 +173,74 @@ def hpat_pandas_series_shape_impl(self): | |||
return hpat_pandas_series_shape_impl | |||
|
|||
|
|||
@overload_method(SeriesType, 'std') | |||
def hpat_pandas_series_std(self, axis=None, skipna=None, level=None, ddof=1, numeric_only=None): |
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.
def hpat_pandas_series_std(self, axis=None, skipna=None, level=None, ddof=1, numeric_only=None): | |
def hpat_pandas_series_std(self, axis=None, skipna=True, level=None, ddof=1, numeric_only=None): |
skipna : bool, default True
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.
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.
According to the Pandas documentation skipna=None
by default for series.std
. I was guided by that.
0/None/'index' - row-wise operation | ||
1/'columns' - column-wise operation | ||
*unsupported* | ||
skipna: :obj:`bool` |
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.
skipna : bool, default True
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.
But default value is None
according to Pandas documentation on this method.
if not isinstance(arg, (types.Omitted, types.NoneType)) and arg is not None: | ||
raise TypingError('{} Unsupported parameters. Given {}: {}'.format(_func_name, name, arg)) | ||
|
||
def hpat_pandas_series_std_impl(self, axis=None, skipna=None, level=None, ddof=1, numeric_only=None): |
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.
def hpat_pandas_series_std_impl(self, axis=None, skipna=None, level=None, ddof=1, numeric_only=None): | |
def hpat_pandas_series_std_impl(self, axis=None, skipna=True, level=None, ddof=1, numeric_only=None): |
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.
Pandas documentation says otherwise.
f762289
to
52db8cc
Compare
No description provided.