Atividade Pandas#13
Open
francytelma wants to merge 1 commit into
Open
Conversation
| # - Crie uma nova coluna chamada 'Streaming Popularity', que seja a média da popularidade nas plataformas 'Spotify Popularity', 'YouTube Views', 'TikTok Likes', e 'Shazam Counts'. | ||
| # (lembrem-se que só é possível calcular médias e fazer operações matemáticas com tipos númericos) | ||
|
|
||
| df['Streaming Popularity'] = (df['Spotify Popularity'] + df['YouTube Views'] + df['TikTok Likes'] + df['Shazam Counts']) / 4 |
Collaborator
There was a problem hiding this comment.
sempre tente uma solução vá funcionar para o máximo de itens possíveis, por exemplo: não soubéssemos a quantidade de itens com os quais queremos calcular a média. Como calcularíamos? O uso do mean() pode facilitar nisso
| #print(df.columns) | ||
|
|
||
| # - Crie uma coluna 'Total Streams', somando os valores de 'Spotify Streams', 'YouTube Views', 'TikTok Views', 'Pandora Streams', e 'Soundcloud Streams'. | ||
| df['Total Streams'] = (df['Spotify Streams'] + df['YouTube Views'] + df['TikTok Views'] + df['Pandora Streams'] + df['Soundcloud Streams']) |
Collaborator
There was a problem hiding this comment.
o mesmo vale aqui, se vc tivesse que somar o resultado de um numero incontáveis de colunas, como faria? O uso do sum() te ajudaria nesse problema
| filtradas.to_json("./faixas_filtradas.json", index= False) | ||
|
|
||
| # - Garanta que o arquivo foi salvo corretamente | ||
| df = pd.read_json("../para_casa/mais_ouvidas_2024.json") |
Collaborator
There was a problem hiding this comment.
acho que quis dizer:
Suggested change
| df = pd.read_json("../para_casa/mais_ouvidas_2024.json") | |
| df = pd.read_json("../faixas_filtradas.json") |
certo?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Atividade Pandas S11