Potentially unneeded data copying

Aberta
#457 8 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
34/100
Tipo de issue
Refatoração
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
pandas, python
Domínio
performance

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Python
Estrelas
2.3k
Forks
391
Merge médio
11h 34min
PRs com merge (30d)
11

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de feature-engine/feature_engine

Todas as issues de feature-engine/feature_engine

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.