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

Atividade de casa - S11 #8

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Atividade de casa - S11 #8

wants to merge 4 commits into from

Conversation

elys4
Copy link

@elys4 elys4 commented Aug 14, 2024

No description provided.

Comment on lines +23 to +24
if df[col].dtype == 'object':
df[col] = pd.to_numeric(df[col].str.replace(',', '', regex=True), 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.

já que se deu ao trabalho de criar a num_cols manualmente, porque está fazendo esse código e porque optou pelo uso do to_numeric() ao invés do astype()? 🤔



# Corrigindo a coluna 'Release Date' para o formato datetime
df['Release Date'] = pd.to_datetime(df['Release Date'], 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.

o que o parâmetro errors='coerce' faz?

Comment on lines +37 to +39
for col in sum_cols:
if col not in df.columns:
print(f"Coluna {col} não encontrada no DataFrame.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

você converteu todas elas para float logo acima, não?

print(df.dtypes)

# Verificando se todas as colunas envolvidas na soma são numéricas
sum_cols = ['Spotify Streams', 'YouTube Views', 'TikTok Views', 'Pandora Streams', 'Soundcloud Streams']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
sum_cols = ['Spotify Streams', 'YouTube Views', 'TikTok Views', 'Pandora Streams', 'Soundcloud Streams']
streams_cols = ['Spotify Streams', 'YouTube Views', 'TikTok Views', 'Pandora Streams', 'Soundcloud Streams']

filtered_df.to_json('faixas_filtradas.json', orient='records', lines=True)

# Verificando se o arquivo JSON foi salvo corretamente
import os
Copy link
Collaborator

Choose a reason for hiding this comment

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

os imports vão no começo do código

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

@manuellysuzik manuellysuzik added the who? não possível encontrar o nome da aluna pelo seu username label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
who? não possível encontrar o nome da aluna pelo seu username
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants