scikit-learn-contrib/category_encoders

Handle missing in one hot encoder

开放

#400 创建于 2023年3月12日

 (3 条评论) (0 个反应) (0 位负责人)Python (397 个派生)batch import
buggood first issue

仓库指标

星标
 (2,322 个星标)
PR 合并指标
 (平均合并 4天 10小时) (30 天内合并 2 个 PR)

描述

Expected Behavior

Currently, handle_missing=value adds a new column although the documentation says 'value' will encode a new value as 0 in every dummy column. Furthermore, we need a test for this

Actual Behavior

adds a column instead of using all 0

Steps to Reproduce the Problem

from category_encoders import OneHotEncoder
import pandas as pd

he = OneHotEncoder(handle_missing="value")

data = [("foo", 1), ("bar", 2), (None, 6)]
data = pd.DataFrame(data, columns=["c1", "c2"])
print(he.fit_transform(data))

Specifications

  • Version: 2.6
  • Platform: linux

贡献者指南