Skip to content

Commit

Permalink
fix coercion
Browse files Browse the repository at this point in the history
  • Loading branch information
aspeddro committed Mar 26, 2024
1 parent 328b199 commit 389f060
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion models/br_inep_censo_escolar/code/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@

for i in arch.loc[arch["bigquery_type"] == "STRING"]["name"]:
if i in df.columns:
df[i] = df[i].astype("Int64").astype(str)
# NOTE: fillna("") porque a coerção astype("Int64").astype("String")
# cria <NA> e ao salvar o csv, <NA> não é salvo como um valor
# vazio i.e "", ele salva como <NA> e isso é intepretado como uma string no BQ
df[i] = df[i].astype("Int64").astype("string").fillna("") # type: ignore

for i in arch.loc[arch["bigquery_type"] == "INT64"]["name"]:
if i in df.columns:
Expand Down

0 comments on commit 389f060

Please sign in to comment.