DataFort Transformations Module
This module provides standalone functions for transforming data frame columns. All functions take a data_frame as the first argument instead of being type-bound procedures.
df_normalize_column_real(df, col_index) - Normalize to [0,1] rangedf_standardize_column_real(df, col_index) - Standardize to mean=0, std=1df_abs_column_real(df, col_index) - Absolute value for real columndf_abs_column_integer(df, col_index) - Absolute value for integer columndf_cumsum_real(df, col_index) - Cumulative sum for real columndf_cumsum_integer(df, col_index) - Cumulative sum for integer columndf_diff_real(df, col_index) - Differences between consecutive rows (real)df_diff_integer(df, col_index) - Differences between consecutive rows (integer)df_replace_value_real(df, col_index, old_value, new_value) - Replace values in real columndf_replace_value_integer(df, col_index, old_value, new_value) - Replace values in integer columndf_clip_real(df, col_index, min_val, max_val) - Clip real values to rangedf_clip_integer(df, col_index, min_val, max_val) - Clip integer values to rangedf_round_column(df, col_index, decimals) - Round to decimal placesdf_log_column(df, col_index) - Natural logarithmdf_exp_column(df, col_index) - Exponentialdf_sqrt_column(df, col_index) - Square rootdf_pow_column(df, col_index, power) - Raise to powerdf_apply_to_column(df, col_index, func) - Apply custom function| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rk), | intent(in) | :: | x |
Calculate maximum of a real column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Calculate mean of a real column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Calculate minimum of a real column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Calculate standard deviation of a real column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Calculate differences between consecutive rows (result has n-1 elements)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Calculate differences between consecutive rows (result has n-1 elements)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Take absolute value of all elements in an integer column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Take absolute value of all elements in a real column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Apply custom function to column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| procedure(transform_func) | :: | func |
Clip (clamp) values in an integer column to [min_val, max_val]
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| integer(kind=ik), | intent(in) | :: | min_val | |||
| integer(kind=ik), | intent(in) | :: | max_val |
Clip (clamp) values in a real column to [min_val, max_val]
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| real(kind=rk), | intent(in) | :: | min_val | |||
| real(kind=rk), | intent(in) | :: | max_val |
Calculate cumulative sum for an integer column (modifies in place)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Calculate cumulative sum for a real column (modifies in place)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Apply exponential to column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Apply natural logarithm to column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Normalize a real column to [0, 1] range
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Raise column to a power
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| real(kind=rk), | intent(in) | :: | power |
Replace all occurrences of a value in an integer column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| integer(kind=ik), | intent(in) | :: | old_value | |||
| integer(kind=ik), | intent(in) | :: | new_value |
Replace all occurrences of a value in a real column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| real(kind=rk), | intent(in) | :: | old_value | |||
| real(kind=rk), | intent(in) | :: | new_value |
Round real column to specified number of decimal places
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| integer, | intent(in) | :: | decimals |
Apply square root to column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Standardize a real column (z-score: mean=0, std=1)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |