@@ -2926,7 +2926,7 @@ def hpat_pandas_series_take_impl(self, indices, axis=0, is_copy=False):
29262926
29272927
29282928@sdc_overload_method (SeriesType , 'idxmax' )
2929- def hpat_pandas_series_idxmax (self , axis = None , skipna = True ):
2929+ def hpat_pandas_series_idxmax (self , axis = None , skipna = None ):
29302930 """
29312931 Intel Scalable Dataframe Compiler User Guide
29322932 ********************************************
@@ -2975,25 +2975,48 @@ def hpat_pandas_series_idxmax(self, axis=None, skipna=True):
29752975 if not isinstance (self .data .dtype , types .Number ):
29762976 ty_checker .raise_exc (self .data .dtype , 'int, float' , 'self.data.dtype' )
29772977
2978- if not (isinstance (skipna , (types .Omitted , types .Boolean , bool )) or skipna is True ):
2978+ if not (isinstance (skipna , (types .Omitted , types .Boolean , bool )) or skipna is None ):
29792979 ty_checker .raise_exc (skipna , 'bool' , 'skipna' )
29802980
29812981 if not (isinstance (axis , types .Omitted ) or axis is None ):
29822982 ty_checker .raise_exc (axis , 'None' , 'axis' )
29832983
2984- if isinstance (self .index , types .NoneType ) or self .index is None :
2985- def hpat_pandas_series_idxmax_impl (self , axis = None , skipna = True ):
2986- return numpy .argmax (self ._data )
2987-
2988- return hpat_pandas_series_idxmax_impl
2984+ none_index = isinstance (self .index , types .NoneType ) or self .index is None
2985+ if isinstance (self .data , StringArrayType ):
2986+ def hpat_pandas_series_idxmax_str_impl (self , axis = None , skipna = None ):
2987+ if skipna is None :
2988+ _skipna = True
2989+ else :
2990+ raise ValueError ("Method idxmax(). Unsupported parameter 'skipna'=False with str data" )
29892991
2990- else :
2991- def hpat_pandas_series_idxmax_index_impl (self , axis = None , skipna = True ):
2992- # no numpy.nanargmax is supported by Numba at this time
29932992 result = numpy .argmax (self ._data )
2993+ if none_index == True : # noqa
2994+ return result
2995+ else :
2996+ return self ._index [int (result )]
2997+
2998+ return hpat_pandas_series_idxmax_str_impl
2999+
3000+ def hpat_pandas_series_idxmax_impl (self , axis = None , skipna = None ):
3001+ # return numpy.argmax(self._data)
3002+ if skipna is None :
3003+ _skipna = True
3004+ else :
3005+ _skipna = skipna
3006+
3007+ if _skipna :
3008+ result = numpy_like .nanargmax (self ._data )
3009+ else :
3010+ result = numpy_like .argmax (self ._data )
3011+
3012+ if none_index == True : # noqa
3013+ return result
3014+ else :
29943015 return self ._index [int (result )]
29953016
2996- return hpat_pandas_series_idxmax_index_impl
3017+ return numpy_like .argmax (self ._data )
3018+
3019+ return hpat_pandas_series_idxmax_impl
29973020
29983021
29993022@sdc_overload_method (SeriesType , 'mul' )
@@ -3987,7 +4010,7 @@ def hpat_pandas_series_ge_impl(self, other, level=None, fill_value=None, axis=0)
39874010
39884011
39894012@sdc_overload_method (SeriesType , 'idxmin' )
3990- def hpat_pandas_series_idxmin (self , axis = None , skipna = True ):
4013+ def hpat_pandas_series_idxmin (self , axis = None , skipna = None ):
39914014 """
39924015 Intel Scalable Dataframe Compiler User Guide
39934016 ********************************************
@@ -4036,25 +4059,48 @@ def hpat_pandas_series_idxmin(self, axis=None, skipna=True):
40364059 if not isinstance (self .data .dtype , types .Number ):
40374060 ty_checker .raise_exc (self .data .dtype , 'int, float' , 'self.data.dtype' )
40384061
4039- if not (isinstance (skipna , (types .Omitted , types .Boolean , bool )) or skipna is True ):
4062+ if not (isinstance (skipna , (types .Omitted , types .Boolean , bool )) or skipna is None ):
40404063 ty_checker .raise_exc (skipna , 'bool' , 'skipna' )
40414064
40424065 if not (isinstance (axis , types .Omitted ) or axis is None ):
40434066 ty_checker .raise_exc (axis , 'None' , 'axis' )
40444067
4045- if isinstance (self .index , types .NoneType ) or self .index is None :
4046- def hpat_pandas_series_idxmin_impl (self , axis = None , skipna = True ):
4047- return numpy .argmin (self ._data )
4048-
4049- return hpat_pandas_series_idxmin_impl
4068+ none_index = isinstance (self .index , types .NoneType ) or self .index is None
4069+ if isinstance (self .data , StringArrayType ):
4070+ def hpat_pandas_series_idxmin_str_impl (self , axis = None , skipna = None ):
4071+ if skipna is None :
4072+ _skipna = True
4073+ else :
4074+ raise ValueError ("Method idxmin(). Unsupported parameter 'skipna'=False with str data" )
40504075
4051- else :
4052- def hpat_pandas_series_idxmin_index_impl (self , axis = None , skipna = True ):
4053- # no numpy.nanargmin is supported by Numba at this time
40544076 result = numpy .argmin (self ._data )
4077+ if none_index == True : # noqa
4078+ return result
4079+ else :
4080+ return self ._index [int (result )]
4081+
4082+ return hpat_pandas_series_idxmin_str_impl
4083+
4084+ def hpat_pandas_series_idxmin_impl (self , axis = None , skipna = None ):
4085+ # return numpy.argmin(self._data)
4086+ if skipna is None :
4087+ _skipna = True
4088+ else :
4089+ _skipna = skipna
4090+
4091+ if _skipna :
4092+ result = numpy_like .nanargmin (self ._data )
4093+ else :
4094+ result = numpy_like .argmin (self ._data )
4095+
4096+ if none_index == True : # noqa
4097+ return result
4098+ else :
40554099 return self ._index [int (result )]
40564100
4057- return hpat_pandas_series_idxmin_index_impl
4101+ return numpy_like .argmin (self ._data )
4102+
4103+ return hpat_pandas_series_idxmin_impl
40584104
40594105
40604106@sdc_overload_method (SeriesType , 'lt' )
0 commit comments