Skip to content

featurebyte.Feature.str.pad

pad(
width: int,
side: Literal["left", "right", "both"]="left",
fillchar: str=" "
) -> Feature

Description

Pads each string element up to the specified width.

Parameters

  • width: int
    Minimum width of resulting string. Additional characters will be filled with fillchar.

  • side: Literal["left", "right", "both"]
    default: "left"
    Padding direction.

  • fillchar: str
    default: " "
    Character used to pad.

Returns

  • Feature
    A new Feature object.

Examples

Pad the Title column to 10 characters:

>>> feature = catalog.get_feature("ProductGroupLookup")
>>> feature_group = fb.FeatureGroup([feature])
>>> feature_group["ProductGroupLookupPadded"] = feature.str.pad(10, fillchar="0")