Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atividades Semana 11 #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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