Skip to content

Conversation

@BrendaNogueiras
Copy link

No description provided.

Comment on lines +18 to +21
for col in Columns:
if df[col].dtype == 'object':
df[col] = df[col].str.replace(',', '', regex=False)
df[col] = pd.to_numeric(df[col], errors='coerce')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tenho dúvidas:

  • Ao tentar converter todos os tipos que são object para float você vai encontrar muitos que estão no formato correto
  • Porque está usando to_numeric ao invés de astype?
  • fora da condição você também decide converter para número. O que eu posso esperar? um float ou um int?

df[col] = pd.to_numeric(df[col], errors='coerce')

#Substitui por zero as linhas que tem o NaN
df = df.fillna(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mas vazio é diferente de valor 0, certo?

Copy link
Collaborator

@manuellysuzik manuellysuzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants