Potentially unneeded data copying

Aperta
#457 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
34/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
pandas, python
Ambito
performance

Direzione di ricerca

Start at feature_engine/dataframe_checks.py, in check_X around line 50. Trace its callers such as CountFrequencyEncoder and the related tests to see where copies are made, then run the transformer test suite before and after any change. Done means check_X no longer forces a full copy, the user's original frame stays unmodified, and tests plus a memory check confirm the behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

There is a function check_X used throughout the library which produces a copy of the data in order to avoid potential in-place modifications:
https://github.com/feature-engine/feature_engine/blob/248465e111416f88a4784b5e2e13a83d47e1f00e/feature_engine/dataframe_checks.py#L50

This is inefficient since it generates an extra copy of the whole data, and as a given transformer such as CountFrequencyEncoder processes that data further, a third copy will be generated until it replaces the earlier copy. It is possible to modify data frames column-by-column without having to produce an extra copy of the data and without affecting the original object that is passed by the user by using pd.DataFrame.assign, which could potentially result in a significant decrease in memory usage in large datasets and a small speed up.

Lingua principale
Python
Stelle
2.3k
Fork
391
Merge medio
11h 34m
PR unite (30g)
11

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di feature-engine/feature_engine

Tutte le issue di feature-engine/feature_engine

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.