scikit-learn-contrib/category_encoders

Handle missing in one hot encoder

Open

#400 ouverte le 12 mars 2023

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)Python (397 forks)batch import
buggood first issue

Métriques du dépôt

Stars
 (2 322 stars)
Métriques de merge PR
 (Merge moyen 4j 10h) (2 PRs mergées en 30 j)

Description

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

Guide contributeur