feature-engine / feature_engine

Feature engineering package with sklearn like functionality
https://feature-engine.trainindata.com/
BSD 3-Clause "New" or "Revised" License
1.8k stars 304 forks source link

warnings in OHE with latest pandas version #689

Closed solegalli closed 9 months ago

solegalli commented 10 months ago

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

feature_engine\encoding\onehot.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