yuenshingyan/MissForest

Problem when column has no missingness

TorbenSell opened this issue · 2 comments

Hi,

I am using MissForest to impute a data frame consisting of two columns, of which only the second one has missing values. I get an error message:

    492     if (
    493             n_iter >= 2 and
    494             len(self.categorical) > 0 and
    495             all_gamma_cat[-1] > all_gamma_cat[-2]
    496     ):
    497         break
    499     if (
    500             n_iter >= 2 and
    501             len(self.numerical) > 0 and
--> 502             all_gamma_num[-1] > all_gamma_num[-2]
    503     ):
    504         break
    506 # mapping the encoded values back to its categories.

IndexError: list index out of range

The code works well as long as I have missing values in both columns (tested by artificially adding a nan in the first column), but not if the first column is completely observed.

Can this be fixed?

Thank you!

Hi, I have re-created the bug and fixed it. So far, I don't have any problem on my side.
https://pypi.org/project/MissForest/