Math

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

Base class for all Cols implementations

sum(cols='*', tidy=True, compute=True)[source]

Return the sum of the values over the requested column.

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

  • tidy – The result format. If True it will return a value if you process a column or column name and value if not. If False it will return the functions name, the column name.

  • compute – Compute the final result. False imply to return a delayed object.

Returns

Column containing the sum of multiple columns.

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

Subtract two or more columns.

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

  • output_col – Single output column in case no value is passed

Returns

Dataframe with the result of the arithmetic operation appended.

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

Multiply two or more columns.

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

  • output_col – Single output column in case no value is passed

Returns

Dataframe with the result of the arithmetic operation appended.

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

Divide two or more columns.

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

  • output_col – Single output column in case no value is passed

Returns

Dataframe with the result of the arithmetic operation appended.

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

Return the absolute numeric value of each value 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

Column containing the absolute value of each element.

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

Return Euler’s number, e (~2.718) raised to the power of each value 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

Column containing the absolute value of each element.

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

Return the Modulo of each value in a column.

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

  • divisor

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

Returns

Column containing Molulo of each element.

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

Return the logarithm base 10 of each value in a column.

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

  • base

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

Returns

Column containing the logarithm base 10 of each element.

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

Return the natural logarithm of each value 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

Column containing the natural logarithm of each element.

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

Return the power of each value in a column.

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

  • power

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

Returns

Column containing the power of each element.

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

Return the square root of each value 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

Column containing the square root of each element.

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

Return the reciprocal(1/x) of of each value 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

Column containing the reciprocal of each element.

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

Round a DataFrame to a variable number of decimal places.

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

  • decimals – The number of decimals you want to

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

Returns

Column containing the round of each element.

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

Round each number in a column down to the nearest integer.

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

Column containing the floor of each element.

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

Round each number in a column up to the nearest integer.

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

Column containing the ceil of each element.