Skip to content

sklego/column-capper-fraction

Rule column-capper-fraction
Pack scikit-lego
Severity error
Fix none, edit by hand
Library versions every version

ColumnCapper reads quantile_range in percent, so (0.05, 0.95) caps almost every value at a percentile below 1. Multiply both numbers by 100.

capper = ColumnCapper(quantile_range=(0.05, 0.95))
capper = ColumnCapper(quantile_range=(5, 95))

The rule reports ColumnCapper(quantile_range=(0.05, 0.95)) and other ranges whose upper number is 1 or less. ColumnCapper reads the range in percent, as its default (5.0, 95.0) shows, so fractions cap every value at a percentile below 1.

xpd has no automatic fix, so make the change by hand.

quantile_range Values changed, of 10,000 normal values Values after capping
(0.05, 0.95) 9,910 92 distinct values from -3.272 to -2.379
(5, 95) 1,000 from -1.628 to 1.640

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

ColumnCapper reads quantile_range in percent, so this range caps at percentiles below 1. On 10,000 normal values (0.05, 0.95) changed 9,910 of them, where (5, 95) changed 1,000. Multiply both numbers by 100.

Browse the other rules of the scikit-lego pack.