Repository navigation
Preservar tipos do polars nas colunas de entrada - #215
Closed
mayuriphad wants to merge 1 commit into
Closed
mayuriphad wants to merge 1 commit into
mayuriphad wants to merge 1 commit into
Conversation
to_pandas() turned an Int64 column with nulls into float64 (losing ids above 2**53) and from_pandas() returned Date as Datetime. Keep nullable integers through the pandas step and cast input columns back to their original polars dtype. Signed-off-by: mayuriphad <mayuriphad656@gmail.com>
Owner
|
Muito obrigado pelo PR, @mayuriphad, e pelo cuidado com ele: o diagnóstico da causa está preciso, os testes cobrem os dois casos da issue e o CHANGELOG veio junto. Os seus testes de inteiro com nulo e de Obrigado de novo pela contribuição. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O quê
Com entrada polars, as colunas que o dataframeit não toca voltavam com tipo diferente:
Int64com nulo viravaFloat64(ids acima de 2**53 perdiam precisão) eDateviravaDatetime[ms].Por quê
to_pandas()leva inteiro com nulo afloat64, epl.from_pandas()não restaura o schema original.Como
ConversionInfoguarda o schema polars de entrada._polars_to_pandasmantém inteiros com nulo como inteiros anuláveis do pandas._restore_polars_dtypesreaplica o tipo original às colunas de entrada na volta; uma coluna que não aceita o tipo fica como está.Datee o ramo de cast recusado.CHANGELOG.mdatualizado.Testes
pytest tests: mesmas 3 falhas de antes da mudança (sem relação) e +4 testes novos passando.ruff checkeruff format --checkpassam.Closes #195