@@ -613,6 +613,72 @@ def hpat_pandas_stringmethods_startswith_impl(self, pat, na=None):
613613 return hpat_pandas_stringmethods_startswith_impl
614614
615615
616+ @overload_method (StringMethodsType , 'zfill' )
617+ def hpat_pandas_stringmethods_zfill (self , width ):
618+ """
619+ Intel Scalable Dataframe Compiler User Guide
620+ ********************************************
621+ Pandas API: pandas.Series.str.zfill
622+
623+ Examples
624+ --------
625+ .. literalinclude:: ../../../examples/series_str_zfill.py
626+ :language: python
627+ :lines: 27-
628+ :caption: Pad strings in the Series by prepending '0' characters
629+ :name: ex_series_str_zfill
630+
631+ .. code-block:: console
632+
633+ > python ./series_str_zfill.py
634+ 0 00dog
635+ 1 00foo
636+ 2 00bar
637+ dtype: object
638+
639+ .. todo:: Add support of 32-bit Unicode for `str.zfill()`
640+
641+ Intel Scalable Dataframe Compiler Developer Guide
642+ *************************************************
643+
644+ Pandas Series method :meth:`pandas.core.strings.StringMethods.zfill()` implementation.
645+
646+ Note: Unicode type of list elements are supported only. Numpy.NaN is not supported as elements.
647+
648+ .. only:: developer
649+
650+ Test: python -m sdc.runtests -k sdc.tests.test_series.TestSeries.test_series_zfill
651+
652+ Parameters
653+ ----------
654+ self: :class:`pandas.core.strings.StringMethods`
655+ input arg
656+ width: :obj:`int`
657+ Minimum width of resulting string
658+
659+ Returns
660+ -------
661+ :obj:`pandas.Series`
662+ returns :obj:`pandas.Series` object
663+ """
664+
665+ ty_checker = TypeChecker ('Method zfill().' )
666+ ty_checker .check (self , StringMethodsType )
667+
668+ if not isinstance (width , Integer ):
669+ ty_checker .raise_exc (width , 'int' , 'width' )
670+
671+ def hpat_pandas_stringmethods_zfill_impl (self , width ):
672+ item_count = len (self ._data )
673+ result = ['' ] * item_count
674+ for idx , item in enumerate (self ._data ._data ):
675+ result [idx ] = item .zfill (width )
676+
677+ return pandas .Series (result , self ._data ._index , name = self ._data ._name )
678+
679+ return hpat_pandas_stringmethods_zfill_impl
680+
681+
616682def _hpat_pandas_stringmethods_autogen (method_name ):
617683 """"
618684 The function generates a function for 'method_name' from source text that is created on the fly.
0 commit comments