Skip to content

warnings in OHE with latest pandas version #689

Description

@solegalli

I am having issues when running OneHotEncoder. On a jupyter notebook I get a lot of warnings:

feature_engine\encoding\one_hot.py:277: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling frame.insert many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use newframe = frame.copy()
X[f"{feature}_{category}"] = np.where(X[feature] == category, 1, 0)

Is this expected?

I am running Feature Engine version 1.6.1
Pandas version: 2.03

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions