-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from sc0v1n0/dev
style: update names, remove comments
- Loading branch information
Showing
1 changed file
with
8 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
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 |