Skip to content

Commit

Permalink
Merge pull request #14 from sc0v1n0/dev
Browse files Browse the repository at this point in the history
style: update names, remove comments
  • Loading branch information
sc0v0ne authored Aug 26, 2023
2 parents 4f91b50 + 9344805 commit a0c69f0
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/components/query.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
def query_name_title(dataset, nome, top_n):
nome_pesquisa = nome.upper()
# Recebe o valor da id K-Classes
filme = dataset[dataset['title'] == nome_pesquisa][['clusters_genre_type']]
# resetar o index, como possui apenas um linha, acessar mais rápido
reseta_filme = filme.reset_index()
# Adicionar a célula da K-Classes, a uma variável
resetado_filme = reseta_filme.at[0, 'clusters_genre_type']
# Transforma variável string em inteiro
k_id = int(resetado_filme)
# Procura filmes com semelhança usando a k-id = K-Classes
recomendacoes = dataset[dataset['clusters_genre_type'] == k_id][['title', 'gender_type']][:int(top_n)]
recomendacoes.set_index('title')
return recomendacoes
new_search = nome.upper()
movie = dataset[dataset['title'] == new_search][['clusters_genre_type']]
reset_movie = movie.reset_index()
reset_movie = reset_movie.at[0, 'clusters_genre_type']
k_id = int(reset_movie)
result = dataset[dataset['clusters_genre_type'] == k_id][['title', 'gender_type']][:int(top_n)]
result.set_index('title')
return result

0 comments on commit a0c69f0

Please sign in to comment.