Skip to content

Commit

Permalink
add from_file in load_municipio
Browse files Browse the repository at this point in the history
  • Loading branch information
tricktx committed Nov 29, 2024
1 parent 306ce0e commit 7147b8d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pipelines/utils/crawler_cgu/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,18 @@ def download_file(dataset_id: str, table_id: str, year: int, month: int, relativ
# Função para carregar o dataframe
@lru_cache(maxsize=1) # Cache para evitar recarregar a tabela
def load_municipio() -> None:
municipio : pd.DataFrame = bd.read_table(
"br_bd_diretorios_brasil", "municipio", billing_project_id="basedosdados-dev"
municipio: pd.DataFrame = bd.read_table(
"br_bd_diretorios_brasil",
"municipio",
billing_project_id="basedosdados-dev",
from_file=True,
)
municipio["cidade_uf"] = (
municipio["nome"].apply(lambda x: x.upper()) + "-" + municipio["sigla_uf"]
)
return municipio



def get_similar_cities_process(city):
municipio = load_municipio()
results = process.extractOne(city, municipio["cidade_uf"], score_cutoff=70)
Expand Down

0 comments on commit 7147b8d

Please sign in to comment.