Skip to content

Conversation

@LidiMG
Copy link

@LidiMG LidiMG commented Aug 14, 2024

No description provided.

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.

LGTM

print(df.info())

for column in df.columns:
if df[column].dtype == "object":
Copy link
Collaborator

Choose a reason for hiding this comment

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

essa condição induz ao erro de duas maneiras:

1 - Você esta convertendo todas as colunas tipo object sem destinção, inclusive as que DEVEM ser object. e 2 coisas podem acontecer : ou vai falhar em converter e retornar um erro ou por alguma razão vai converter em um valor inesperado , o que vai desqualificar seus dados
3 - Está convertendo TODOS os dados para float, até intendo que essa seja a intenção mas analisar se os dados devem ser mesmo float e modificar o tipo conforme a necessidade tb deve ser algo para se pensar a respeito

df["Release Date"] = pd.to_datetime(df["Release Date"])
print(df.dtypes)

df["Streaming Popularity"] = df[["Spotify Popularity", "YouTube Views", "TikTok Likes", "Shazam Counts"]].mean(axis=1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Como uma boa pratica, salve essa lista de colunas em uma variável que indique o significado dos valores assim o seu código se torna mais legível para quem está trabalhando nele


print(df["Streaming Popularity"])

df["Total Streams"] = df[["Spotify Streams", "YouTube Views", "TikTok Views", "Pandora Streams", "Soundcloud Streams"]].sum(axis=1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

O mesmo para a lista usada aqui no sum

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