toucan_data_sdk/utils/postprocess/math.py
def round_values(df, *, column: str, decimals: int, new_column: str = None):
    """
    Round each value of a column

    ---

    ### Parameters

    *mandatory :*
    - `column` (*str*): name of the column to round
    - `decimals` (*int*): number of decimal to keeep

    *optional :*
    - `new_column` (*str*): name of the new column to create.
      By default, no new column will be created and `column` will be replaced

    ---

    ### Example

    ** Input**

    ENTITY|VALUE_1|VALUE_2
    :-----:|:-----:|:-----:
    A|-1.512|-1.504
    A|0.432|0.14

    ```cson
    round_values:
      column: 'VALUE_1'
      decimals:1
      new_column: 'Pika'
    ```

    **Output**

    ENTITY|VALUE_1|VALUE_2|Pika
    :-----:|:-----:|:-----:|:-----:
    A|-1.512|-1.504|-1.5
    A|0.432|0.14|0.4
    """
    new_column = new_column or column
    df[new_column] = df[column].round(decimals)
    return df
def round_values(df, *, column: str, decimals: int, new_column: str = None):
    new_column = new_column or column
    df[new_column] = df[column].round(decimals)
    return df
def round_values ( df , * , column : str , decimals : int , new_column : str = None ) : new_column = new_column or column df [ new_column ] = df [ column ] . round ( decimals ) return df
Round each value of a column

    ---

    ### Parameters

    *mandatory :*
    - `column` (*str*): name of the column to round
    - `decimals` (*int*): number of decimal to keeep

    *optional :*
    - `new_column` (*str*): name of the new column to create.
      By default, no new column will be created and `column` will be replaced

    ---

    ### Example

    ** Input**

    ENTITY|VALUE_1|VALUE_2
    :-----:|:-----:|:-----:
    A|-1.512|-1.504
    A|0.432|0.14

    ```cson
    round_values:
      column: 'VALUE_1'
      decimals:1
      new_column: 'Pika'
    ```

    **Output**

    ENTITY|VALUE_1|VALUE_2|Pika
    :-----:|:-----:|:-----:|:-----:
    A|-1.512|-1.504|-1.5
    A|0.432|0.14|0.4
Round each value of a column