Strings

class optimus.engines.base.columns.BaseColumns(root: optimus.helpers.types.DataFrameType)[source]

Base class for all Cols implementations

lower(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Lowercase the specified columns.

Parameters
  • cols – “*”, column name or list of column names to be processed.

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns

BaseDataFrame

upper(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Uppercase the specified columns.

Parameters
  • cols – “*”, column name or list of column names to be processed.

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns

BaseDataFrame

title(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Capitalize the first word in a sentence.

Parameters
  • cols – “*”, column name or list of column names to be processed.

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns

BaseDataFrame

capitalize(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Capitalize every word in a sentence.

Parameters
  • cols – “*”, column name or list of column names to be processed.

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns

remove_special_chars(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Remove special chars from a string in a column.

Parameters
  • cols – “*”, column name or list of column names to be processed.

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns

replace(cols='*', search=None, replace_by=None, search_by=None, ignore_case=False, output_cols=None) optimus.helpers.types.DataFrameType[source]

Replace a value, list of values by a specified string.

Parameters
  • cols – ‘*’, list of columns names or a single column name.

  • search – Values to look at to be replaced

  • replace_by – New value to replace the old one. Supports an array when searching by characters.

  • search_by – Can be “full”,”words”,”chars” or “values”.

  • ignore_case – Ignore case when searching for match

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns

DataFrame

normalize_spaces(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Remove extra whitespace between words and trim whitespace from the beginning and the end of each string.

Parameters
  • cols – “*”, column name or list of column names to be processed.

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns

len(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Return the length of every string in a column. :param cols: “*”, column name or list of column names to be processed. :param output_cols: Column name or list of column names where the transformed data will be saved. :return:

abstract static reverse(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Reverse the order of the characters strings in a column.

Parameters
  • cols – “*”, column name or list of column names to be processed.

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns

remove_white_spaces(cols='*', output_cols=None) optimus.helpers.types.DataFrameType[source]

Remove all white spaces from string in a column.

Parameters
  • cols – “*”, column name or list of column names to be processed.

  • output_cols – Column name or list of column names where the transformed data will be saved.

Returns