Count number of unique values in real column
@param df The data frame @param col_index Column index @return Number of unique values (excluding NaN)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(data_frame), | intent(in) | :: | df | |||
integer, | intent(in) | :: | col_index |
function df_nunique_real(df, col_index) result(n_unique) type(data_frame), intent(in) :: df integer, intent(in) :: col_index integer :: n_unique real(rk), dimension(:), allocatable :: unique_vals if (col_index < 1 .or. col_index > df % ncols()) error stop "column index out of range" if (df % dtype(col_index) /= REAL_NUM) error stop "column is not real type" unique_vals = df_unique_real(df, col_index) n_unique = size(unique_vals) end function df_nunique_real