import pandas as pd | |
import numpy as np | |
def find_similar(p_index, similarity_matrix, filtered_df, top_x): | |
selected_row = similarity_matrix[p_index] | |
filtered_indices = filtered_df.index.tolist() | |
print(filtered_indices) | |
index_position_mapping = {index: position for position, index in enumerate(filtered_indices)} | |
print(index_position_mapping) | |
#filtered_column_matrix = similarity_matrix[:, filtered_indices] | |
#top_indexes = np.argsort(selected_row)[-top_x:][::-1] | |
#top_values = selected_row[top_indexes] | |
#top_projects_df = projects_df.iloc[top_indexes] | |
#top_projects_df["similarity"] = top_values | |
return "top_projects_df" | |