datafort_nan Module

DataFort NaN Handling Module

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

Functions

NaN Detection Functions

  • df_isna_real(df, col_index) - Check for NaN values in real column
  • df_isna_integer(df, col_index) - Check for NaN values in integer column

NaN Replacement Functions

  • df_fillna_real(df, col_index, fill_value) - Replace NaN with fill value (real)
  • df_fillna_integer(df, col_index, fill_value) - Replace NaN with fill value (integer)

Row Removal Functions

  • df_dropna(df) - Remove rows containing NaN values

Notes

  • For real columns, NaN is detected using IEEE floating-point NaN
  • For integer columns, NaN is represented by a sentinel value (huge(1_ik))
  • df_dropna returns a new data frame with NaN-containing rows removed
  • df_fillna_* subroutines modify the data frame in-place


Functions

public function df_dropna(df) result(clean_df)

Remove rows containing NaN values

Read more…

Arguments

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

Return Value type(data_frame)

public function df_isna_integer(df, col_index) result(mask)

Check for NaN values in an integer column

Read more…

Arguments

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

Return Value logical, dimension(:), allocatable

public function df_isna_real(df, col_index) result(mask)

Check for NaN values in a real column

Read more…

Arguments

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

Return Value logical, dimension(:), allocatable


Subroutines

public subroutine df_fillna_integer(df, col_index, fill_value)

Replace NaN values in an integer column with a fill value

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(inout) :: df
integer, intent(in) :: col_index
integer(kind=ik), intent(in) :: fill_value

public subroutine df_fillna_real(df, col_index, fill_value)

Replace NaN values in a real column with a fill value

Read more…

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(inout) :: df
integer, intent(in) :: col_index
real(kind=rk), intent(in) :: fill_value