-
Notifications
You must be signed in to change notification settings - Fork 62
Series.max() in new style #189
Conversation
|
|
||
| def hpat_pandas_series_max_impl(self, axis=0, skipna=True, level=None, numeric_only=None): | ||
| if skipna: | ||
| return np.nanmax(self._data) |
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.
Do we expect Numpy data type returned? I suspect we need Series data type constructed here
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.
We return scalars because Series can be returned if level specified. But we don't have multi indexing now and parameter 'level' is not supported.
| dtype = (pandas_timestamp_type | ||
| if isinstance(dtype, types.NPDatetime) else dtype) | ||
| return signature(dtype, *args) | ||
| # @bound_function("series.max") |
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.
This is good. This is typing stage. What happen if comment out definition of the function here https://github.com/IntelPython/hpat/blob/ea6b1a22ba3a04d4495b6a69bb762c09dc41be67/hpat/hiframes/series_kernels.py#L499
|
|
||
|
|
||
| @overload_method(SeriesType, 'max') | ||
| def hpat_pandas_series_max(self, axis=0, skipna=True, level=None, 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.
Parameters are diffrent https://pandas.pydata.org/pandas-docs/version/0.25/reference/api/pandas.Series.max.html?highlight=max#pandas.Series.max
Please fix the 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.
parameter skipna=True is still diffrent
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.
Sorry, looked into pandas sources and found
def max(self, axis=None, skipna=True, *args, **kwargs):
it looks like they have documentation issue
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.
Need to adjust parameters in function
|
|
||
| import operator | ||
| import pandas | ||
| import numpy as np |
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.
Could you please do not rename numpy?
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.
why not? This is how numpy is used is everywhere else.
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.
@fschlimb to keep clear in the code what exactly is used. This is not a strong requirement.
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.
I understand and I also generally prefer fully qualified names. In this particular case we should stay with common practice (e.g. import numpy as np and import pandas ad pd)
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=True
83937ec to
7a25ddd
Compare
…l_series_max # Conflicts: # hpat/datatypes/hpat_pandas_series_functions.py
Due to overloaded method 'max' in numba it calls array.max for SeriesType instead of hpat_pandas_series_max. Firstly, need fix in importing.