Replace NaN values in a real column with a fill value
Replaces all NaN values in the specified column with the given value
@param[in,out] df The data frame instance @param[in] col_index Column index to fill @param[in] fill_value Value to replace NaN with
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(data_frame), | intent(inout) | :: | df | |||
integer, | intent(in) | :: | col_index | |||
real(kind=rk), | intent(in) | :: | fill_value |
subroutine df_fillna_real(df, col_index, fill_value) type(data_frame), intent(inout) :: df integer, intent(in) :: col_index real(rk), intent(in) :: fill_value real(rk), dimension(:), allocatable :: col integer :: i if (col_index < 1 .or. col_index > df % ncols()) error stop "column index out of range" col = df_get_col_real(df, col_index) do i = 1, size(col) if (is_nan_real(col(i))) then col(i) = fill_value end if end do call df_set_col_real(df, col_index, col) end subroutine df_fillna_real