From b407144d380209c2cb00f96cef9d5effd28219f2 Mon Sep 17 00:00:00 2001 From: "Ronaldo S.A. Batista" Date: Sat, 24 Feb 2024 16:14:27 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Cast=20couting=20column=20to=20i?= =?UTF-8?q?nt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extracao/datasources/smp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extracao/datasources/smp.py b/extracao/datasources/smp.py index f87f9d6..9c7ab3c 100644 --- a/extracao/datasources/smp.py +++ b/extracao/datasources/smp.py @@ -100,7 +100,7 @@ def exclude_duplicated( df_sub.dropna(subset=AGG_SMP, inplace=True) df_sub['Multiplicidade'] = ( df.groupby(AGG_SMP, dropna=True, sort=False, observed=True).size().values - ) + ).astype('int') log = f'[("Colunas", {AGG_SMP}), ("Processamento", "Agrupamento")]' return self.register_log(df_sub, log, df_sub['Multiplicidade'] > 1) @@ -220,9 +220,10 @@ def substitute_coordinates( """ geo = Geography(df) df = geo.merge_df_with_ibge(df) + df['Multiplicidade'] = df.Multiplicidade.astype('int') rows = df.Multiplicidade > 1 - df.loc[rows, 'Latitude'] = df.loc[rows, 'Latitude_IBGE'].copy() - df.loc[rows, 'Longitude'] = df.loc[rows, 'Longitude_IBGE'].copy() + df.loc[rows, 'Latitude'] = df.loc[rows, 'Latitude_IBGE'] + df.loc[rows, 'Longitude'] = df.loc[rows, 'Longitude_IBGE'] log = """[("Colunas", ("Latitude", "Longitude")), ("Processamento", "Substituição por Coordenadas do Município (Agrupamento)")]""" return self.register_log(df, log, df.Multiplicidade > 1)