datafort_advanced Module

DataFort Advanced Operations Module

This module provides standalone advanced data operations for data frames. All functions take a data_frame as the first argument instead of being type-bound procedures.

Functions

Unique Value Functions

  • df_unique_real(df, col_index) - Get unique values from real column
  • df_unique_integer(df, col_index) - Get unique values from integer column
  • df_unique_character(df, col_index) - Get unique values from character column

Value Counting Functions

  • df_value_counts_real(df, col_index) - Count occurrences of each value (real)
  • df_value_counts_integer(df, col_index) - Count occurrences of each value (integer)
  • df_value_counts_character(df, col_index) - Count occurrences of each value (character)

Concatenation Functions

  • df_concat(df1, df2, axis) - Concatenate two data frames (axis=0: vertical, axis=1: horizontal)

Duplicate Detection and Removal Functions

  • df_duplicated(df) - Check which rows are duplicates
  • df_drop_duplicates(df) - Remove duplicate rows
  • df_drop_duplicates_subset(df, col_indices) - Remove duplicates based on specific columns

Notes

  • Unique functions return sorted unique values (except character which is unsorted)
  • Value counts return a data frame with “Value” and “Count” columns
  • Concat with axis=0 requires same number of columns; axis=1 requires same number of rows
  • Duplicate detection compares all data types including NaN values


Functions

public function df_concat(df1, df2, axis) result(result_df)

Concatenate two data frames vertically (rows) or horizontally (columns)

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df1
type(data_frame), intent(in) :: df2
integer, intent(in) :: axis

Return Value type(data_frame)

public function df_drop_duplicates(df) result(unique_df)

Remove duplicate rows

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df

Return Value type(data_frame)

public function df_drop_duplicates_subset(df, col_indices) result(unique_df)

Drop duplicate rows based on specific columns (subset)

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_indices(:)

Return Value type(data_frame)

public function df_duplicated(df) result(is_dup)

Check which rows are duplicates

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df

Return Value logical, dimension(:), allocatable

public function df_nunique_character(df, col_index) result(n_unique)

Count number of unique values in character column

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value integer

public function df_nunique_integer(df, col_index) result(n_unique)

Count number of unique values in integer column

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value integer

public function df_nunique_real(df, col_index) result(n_unique)

Count number of unique values in real column

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value integer

public function df_unique_character(df, col_index) result(unique_vals)

Get unique values from a character column

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value character(len=:), allocatable, (:)

public function df_unique_integer(df, col_index) result(unique_vals)

Get unique values from an integer column

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value integer(kind=ik), dimension(:), allocatable

public function df_unique_real(df, col_index) result(unique_vals)

Get unique values from a real column

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value real(kind=rk), dimension(:), allocatable

public function df_value_counts_character(df, col_index) result(counts_df)

Count occurrences of each value in a character column

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value type(data_frame)

public function df_value_counts_integer(df, col_index) result(counts_df)

Count occurrences of each value in an integer column

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value type(data_frame)

public function df_value_counts_real(df, col_index) result(counts_df)

Count occurrences of each value in a real column

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value type(data_frame)