DataFort Manipulation Module
This module provides standalone functions for data frame manipulation operations. All functions take a data_frame as the first argument instead of being type-bound procedures.
df_select_columns(df, column_indices) - Extract subset of columnsdf_slice_rows(df, start_row, end_row) - Extract row rangedf_filter_rows_logical(df, logical_col_index) - Filter rows by logical columndf_filter_rows_real_range(df, col_index, min_val, max_val) - Filter rows by real value rangedf_filter_rows_integer_range(df, col_index, min_val, max_val) - Filter rows by integer value rangedf_filter_rows_string_pattern(df, col_index, pattern) - Filter rows by string patterndf_copy(df) - Create a deep copy of the data framedf_transpose(df) - Transpose the data frame (converts to character)df_rename_column(df, col_index, new_name) - Rename a columndf_drop_column(df, col_index) - Remove a columndf_reorder_columns(df, new_order) - Reorder columnsCreate a deep copy of a data frame
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df |
Filter rows by integer value range
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| integer(kind=ik), | intent(in) | :: | min_val | |||
| integer(kind=ik), | intent(in) | :: | max_val |
Filter rows based on a logical column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | logical_col_index |
Filter rows by real value range
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| real(kind=rk), | intent(in) | :: | min_val | |||
| real(kind=rk), | intent(in) | :: | max_val |
Filter rows by string pattern
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| character(len=*), | intent(in) | :: | pattern |
Check if character values are in a given list
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| character(len=*), | intent(in), | dimension(:) | :: | values |
Check if integer values are in a given list
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| integer(kind=ik), | intent(in), | dimension(:) | :: | values |
Check if real values are in a given list
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| real(kind=rk), | intent(in), | dimension(:) | :: | values |
Select specific columns from a data frame
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in), | dimension(:) | :: | column_indices |
Slice rows to create a new data frame
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | start_row | |||
| integer, | intent(in) | :: | end_row |
Transpose a data frame
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df |
Helper subroutine to copy a column from one dataframe to another
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | source_df | |||
| integer, | intent(in) | :: | col_index | |||
| type(data_frame), | intent(inout) | :: | target_df |
Helper subroutine to copy filtered rows for a single column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | source_df | |||
| type(data_frame), | intent(inout) | :: | target_df | |||
| integer, | intent(in) | :: | col_index | |||
| integer, | intent(in), | dimension(:) | :: | selected_rows |
Drop a column from the data frame
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index |
Insert a character column at a specific position
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| character(len=*), | intent(in), | dimension(:) | :: | data | ||
| integer, | intent(in) | :: | position | |||
| character(len=*), | intent(in), | optional | :: | header |
Insert a complex column at a specific position
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| complex(kind=rk), | intent(in), | dimension(:) | :: | data | ||
| integer, | intent(in) | :: | position | |||
| character(len=*), | intent(in), | optional | :: | header |
Insert an integer column at a specific position
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer(kind=ik), | intent(in), | dimension(:) | :: | data | ||
| integer, | intent(in) | :: | position | |||
| character(len=*), | intent(in), | optional | :: | header |
Insert a logical column at a specific position
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| logical, | intent(in), | dimension(:) | :: | data | ||
| integer, | intent(in) | :: | position | |||
| character(len=*), | intent(in), | optional | :: | header |
Insert a real column at a specific position
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| real(kind=rk), | intent(in), | dimension(:) | :: | data | ||
| integer, | intent(in) | :: | position | |||
| character(len=*), | intent(in), | optional | :: | header |
Rename a column in the data frame
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| character(len=*), | intent(in) | :: | new_name |
Reorder columns in the data frame
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in), | dimension(:) | :: | new_order |