Skip to content

Commit

Permalink
🐛 Cast couting column to int
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldokun committed Feb 24, 2024
1 parent e39572e commit b407144
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions extracao/datasources/smp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b407144

Please sign in to comment.