Skip to content

numeric_calc

numeric_calc ¤

IntegerCalc ¤

IntegerCalc(
    dataframe: DataFrame, column_name: str = "systime"
)

Bases: Base

Provides class methods for performing calculations on integer columns in a pandas DataFrame.

scale_column classmethod ¤

scale_column(
    dataframe: DataFrame,
    column_name: str = "value_integer",
    factor: float = 1,
) -> pd.DataFrame

Scales the integer column by the given factor.

Parameters:

Name Type Description Default
dataframe DataFrame

The DataFrame to perform the operation on.

required
column_name str

The column to apply the scaling to.

'value_integer'
factor float

The scaling factor.

1

Returns:

Type Description
DataFrame

pd.DataFrame: The DataFrame with the scaled column.

offset_column classmethod ¤

offset_column(
    dataframe: DataFrame,
    column_name: str = "value_integer",
    offset_value: float = 0,
) -> pd.DataFrame

Offsets the integer column by the given value.

Parameters:

Name Type Description Default
dataframe DataFrame

The DataFrame to perform the operation on.

required
column_name str

The column to apply the offset to.

'value_integer'
offset_value float

The value to add (positive) or subtract (negative) from each element in the column.

0

Returns:

Type Description
DataFrame

pd.DataFrame: The DataFrame with the offset column.

divide_column classmethod ¤

divide_column(
    dataframe: DataFrame,
    column_name: str = "value_integer",
    divisor: float = 1,
) -> pd.DataFrame

Divides each value in the integer column by the given divisor.

Parameters:

Name Type Description Default
dataframe DataFrame

The DataFrame to perform the operation on.

required
column_name str

The column to apply the division to.

'value_integer'
divisor float

The value by which to divide each element.

1

Returns:

Type Description
DataFrame

pd.DataFrame: The DataFrame with the divided column.

subtract_column classmethod ¤

subtract_column(
    dataframe: DataFrame,
    column_name: str = "value_integer",
    subtract_value: float = 0,
) -> pd.DataFrame

Subtracts a given value from each element in the integer column.

Parameters:

Name Type Description Default
dataframe DataFrame

The DataFrame to perform the operation on.

required
column_name str

The column to apply the subtraction to.

'value_integer'
subtract_value float

The value to subtract from each element.

0

Returns:

Type Description
DataFrame

pd.DataFrame: The DataFrame with the subtracted column.

calculate_with_fixed_factors classmethod ¤

calculate_with_fixed_factors(
    dataframe: DataFrame,
    column_name: str = "value_integer",
    multiply_factor: float = 1,
    add_factor: float = 0,
) -> pd.DataFrame

Performs a calculation by multiplying with a factor and then adding an additional factor.

Parameters:

Name Type Description Default
dataframe DataFrame

The DataFrame to perform the operation on.

required
column_name str

The column to apply the calculations to.

'value_integer'
multiply_factor float

The factor to multiply each value by. Defaults to 1 (no scaling).

1
add_factor float

The value to add after multiplication. Defaults to 0 (no offset).

0

Returns:

Type Description
DataFrame

pd.DataFrame: The DataFrame after applying the calculations.

mod_column classmethod ¤

mod_column(
    dataframe: DataFrame,
    column_name: str = "value_integer",
    mod_value: int = 1,
) -> pd.DataFrame

Performs a modulus operation on the integer column with a specified value.

Parameters:

Name Type Description Default
dataframe DataFrame

The DataFrame to perform the operation on.

required
column_name str

The column to apply the modulus operation to.

'value_integer'
mod_value int

The value to perform the modulus operation with.

1

Returns:

Type Description
DataFrame

pd.DataFrame: The DataFrame with the modulus operation applied.

power_column classmethod ¤

power_column(
    dataframe: DataFrame,
    column_name: str = "value_integer",
    power_value: float = 1,
) -> pd.DataFrame

Raises each value in the integer column to the power of a specified value.

Parameters:

Name Type Description Default
dataframe DataFrame

The DataFrame to perform the operation on.

required
column_name str

The column to apply the power operation to.

'value_integer'
power_value float

The exponent to raise each element to.

1

Returns:

Type Description
DataFrame

pd.DataFrame: The DataFrame with the power operation applied.