Wintersmith commited on
Commit
88d6858
·
verified ·
1 Parent(s): a388efc

Upload recommender_system.py

Browse files
Files changed (1) hide show
  1. recommender_system.py +3 -3
recommender_system.py CHANGED
@@ -71,11 +71,11 @@ def recommend_books(df: pd.DataFrame, book_to_be_recommended: str) -> pd.DataFra
71
  correlations_df = correlations_df.rename(columns={'Book-Rating': 'Average ratings'})
72
 
73
  # Sort by correlation value
74
- correlations_df = correlations_df.sort_values('Correlation', ascending=False)
75
 
76
  # convert correlation column to percentage and limit to two decimals
77
- correlations_df['Correlation'] = correlations_df['Correlation'] * 100
78
- correlations_df['Correlation'] = correlations_df['Correlation'].round(2)
79
 
80
  # Remove the book being recommended from the list
81
  correlations_df = correlations_df[correlations_df['Book-Title'] != book_to_be_recommended]
 
71
  correlations_df = correlations_df.rename(columns={'Book-Rating': 'Average ratings'})
72
 
73
  # Sort by correlation value
74
+ correlations_df = correlations_df.sort_values('Correlation [%]', ascending=False)
75
 
76
  # convert correlation column to percentage and limit to two decimals
77
+ correlations_df['Correlation [%]'] = correlations_df['Correlation [%]'] * 100
78
+ correlations_df['Correlation [%]'] = correlations_df['Correlation [%]'].round(2)
79
 
80
  # Remove the book being recommended from the list
81
  correlations_df = correlations_df[correlations_df['Book-Title'] != book_to_be_recommended]