@@ -418,6 +418,150 @@ def hpat_pandas_stringmethods_len_impl(self):
418418 return hpat_pandas_stringmethods_len_impl
419419
420420
421+ @overload_method (StringMethodsType , 'ljust' )
422+ def hpat_pandas_stringmethods_ljust (self , width , fillchar = ' ' ):
423+ """
424+ Intel Scalable Dataframe Compiler User Guide
425+ ********************************************
426+ Pandas API: pandas.Series.str.ljust
427+
428+ Examples
429+ --------
430+ .. literalinclude:: ../../../examples/series_str_ljust.py
431+ :language: python
432+ :lines: 27-
433+ :caption: Filling right side of strings in the Series with an additional character
434+ :name: ex_series_str_ljust
435+
436+ .. code-block:: console
437+
438+ > python ./series_str_ljust.py
439+ 0 dog**
440+ 1 foo**
441+ 2 bar**
442+ dtype: object
443+
444+ .. todo:: Add support of 32-bit Unicode for `str.ljust()`
445+
446+ Intel Scalable Dataframe Compiler Developer Guide
447+ *************************************************
448+
449+ Pandas Series method :meth:`pandas.core.strings.StringMethods.ljust()` implementation.
450+
451+ Note: Unicode type of list elements are supported only. Numpy.NaN is not supported as elements.
452+
453+ .. only:: developer
454+
455+ Test: python -m sdc.runtests -k sdc.tests.test_series.TestSeries.test_series_ljust
456+
457+ Parameters
458+ ----------
459+ self: :class:`pandas.core.strings.StringMethods`
460+ input arg
461+ width: :obj:`int`
462+ Minimum width of resulting string
463+ fillchar: :obj:`str`
464+ Additional character for filling, default is whitespace
465+
466+ Returns
467+ -------
468+ :obj:`pandas.Series`
469+ returns :obj:`pandas.Series` object
470+ """
471+
472+ ty_checker = TypeChecker ('Method ljust().' )
473+ ty_checker .check (self , StringMethodsType )
474+
475+ if not isinstance (width , Integer ):
476+ ty_checker .raise_exc (width , 'int' , 'width' )
477+
478+ accepted_types = (Omitted , StringLiteral , UnicodeType )
479+ if not isinstance (fillchar , accepted_types ) and fillchar != ' ' :
480+ ty_checker .raise_exc (fillchar , 'str' , 'fillchar' )
481+
482+ def hpat_pandas_stringmethods_ljust_impl (self , width , fillchar = ' ' ):
483+ item_count = len (self ._data )
484+ result = ['' ] * item_count
485+ for idx , item in enumerate (self ._data ._data ):
486+ result [idx ] = item .ljust (width , fillchar )
487+
488+ return pandas .Series (result , self ._data ._index , name = self ._data ._name )
489+
490+ return hpat_pandas_stringmethods_ljust_impl
491+
492+
493+ @overload_method (StringMethodsType , 'rjust' )
494+ def hpat_pandas_stringmethods_rjust (self , width , fillchar = ' ' ):
495+ """
496+ Intel Scalable Dataframe Compiler User Guide
497+ ********************************************
498+ Pandas API: pandas.Series.str.rjust
499+
500+ Examples
501+ --------
502+ .. literalinclude:: ../../../examples/series_str_rjust.py
503+ :language: python
504+ :lines: 27-
505+ :caption: Filling left side of strings in the Series with an additional character
506+ :name: ex_series_str_rjust
507+
508+ .. code-block:: console
509+
510+ > python ./series_str_rjust.py
511+ 0 **dog
512+ 1 **foo
513+ 2 **bar
514+ dtype: object
515+
516+ .. todo:: Add support of 32-bit Unicode for `str.rjust()`
517+
518+ Intel Scalable Dataframe Compiler Developer Guide
519+ *************************************************
520+
521+ Pandas Series method :meth:`pandas.core.strings.StringMethods.rjust()` implementation.
522+
523+ Note: Unicode type of list elements are supported only. Numpy.NaN is not supported as elements.
524+
525+ .. only:: developer
526+
527+ Test: python -m sdc.runtests -k sdc.tests.test_series.TestSeries.test_series_rjust
528+
529+ Parameters
530+ ----------
531+ self: :class:`pandas.core.strings.StringMethods`
532+ input arg
533+ width: :obj:`int`
534+ Minimum width of resulting string
535+ fillchar: :obj:`str`
536+ Additional character for filling, default is whitespace
537+
538+ Returns
539+ -------
540+ :obj:`pandas.Series`
541+ returns :obj:`pandas.Series` object
542+ """
543+
544+ ty_checker = TypeChecker ('Method rjust().' )
545+ ty_checker .check (self , StringMethodsType )
546+
547+ if not isinstance (width , Integer ):
548+ ty_checker .raise_exc (width , 'int' , 'width' )
549+
550+ accepted_types = (Omitted , StringLiteral , UnicodeType )
551+ if not isinstance (fillchar , accepted_types ) and fillchar != ' ' :
552+ ty_checker .raise_exc (fillchar , 'str' , 'fillchar' )
553+
554+ def hpat_pandas_stringmethods_rjust_impl (self , width , fillchar = ' ' ):
555+ item_count = len (self ._data )
556+ result = ['' ] * item_count
557+ for idx , item in enumerate (self ._data ._data ):
558+ result [idx ] = item .rjust (width , fillchar )
559+
560+ return pandas .Series (result , self ._data ._index , name = self ._data ._name )
561+
562+ return hpat_pandas_stringmethods_rjust_impl
563+
564+
421565@overload_method (StringMethodsType , 'startswith' )
422566def hpat_pandas_stringmethods_startswith (self , pat , na = None ):
423567 """
0 commit comments