First off, thank you for maintaining such a useful library, I truly appreciate it.
A bug has been identified in the ImputationKernel class regarding the imputation_order parameter. The handling of "ascending" and "descending" orders is incorrect due to a typo and improper sorting configuration.
Problematic Code
# imputation_kernel.py
if imputation_order in ["ascending", "descending"]:
_na_counts = {
key: value
for key, value in self.na_counts.items()
if key in self.imputed_variables
}
self.imputation_order = list(
Series(_na_counts).sort_values(ascending=False).index
)
if imputation_order == "decending":
self.imputation_order.reverse()
Issues
Typo: "decending" should be "descending".
Incorrect Sorting Configuration: The parameter ascending=False should be ascending=True for ascending order.
Proposed Fix
Update the code as follows:
if imputation_order in ["ascending", "descending"]:
_na_counts = {
key: value
for key, value in self.na_counts.items()
if key in self.imputed_variables
}
self.imputation_order = list(
Series(_na_counts).sort_values(ascending=True).index
)
if imputation_order == "descending":
self.imputation_order.reverse()
Steps to Verify
Test the following code to compare imputation_order for "ascending" and "descending":
First off, thank you for maintaining such a useful library, I truly appreciate it.
A bug has been identified in the
ImputationKernel
class regarding theimputation_order
parameter. The handling of"ascending"
and"descending"
orders is incorrect due to a typo and improper sorting configuration.Problematic Code
Issues
"decending"
should be"descending"
.ascending=False
should beascending=True
for ascending order.Proposed Fix
Update the code as follows:
Steps to Verify
Test the following code to compare
imputation_order
for"ascending"
and"descending"
:Additional Information