feature-engine/feature_engine

warnings in OHE with latest pandas version

Closed this issue · 0 comments

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