Can you help me filter this based on the pos_ratio instead? import pandas as pd import difflib from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity import gradio as gr import numpy as np # Load the data - when deploying, adjust the path to where your dataset will be stored def load_data(): try: # For Hugging Face Spaces deployment, you might need to adjust this path data = pd.read_csv('games_march2025_cleaned.csv', nrows=50000, on_bad_lines='skip', engine='python') return data except Exception as e: print(f"Error loading data: {e}") return None # Prepare the feature vectors for similarity calculation def prepare_features(data): selected_features = ['genres', 'price', 'average_playtime_2weeks', 'tags'] for feature in selected_features: data[feature] = data[feature].fillna('') combined_features = ( data['genres'] + ' ' + data['price'].astype(str) + ' ' + data['average_playtime_2weeks'].astype(str) + ' ' + data['tags'].astype(str) ) vectorizer = TfidfVectorizer() feature_vectors = vectorizer.fit_transform(combined_features) return feature_vectors # Function to get game recommendations def get_recommendations(game_name, data, feature_vectors): list_of_all_titles = data['name'].tolist() find_close_match = difflib.get_close_matches(game_name, list_of_all_titles) if not find_close_match: return "No match found for the game name. Please try another title." closest_match = find_close_match[0] index_of_the_game = data.loc[data['name'] == closest_match].index[0] game_similarity = cosine_similarity(feature_vectors) similarity_scores = list(enumerate(game_similarity[index_of_the_game])) sorted_similar_games = sorted(similarity_scores, key=lambda x: x[1], reverse=True) result_html = "" for i, game in enumerate(sorted_similar_games[1:10], 1): index = game[0] name = data.loc[index, 'name'] about = data.loc[index, 'short_description'] or "No description available" image_url = data.loc[index, 'header_image'] or "" platforms = [] if data.loc[index, 'windows'] == 1: platforms.append("Windows") if data.loc[index, 'mac'] == 1: platforms.append("Mac") if data.loc[index, 'linux'] == 1: platforms.append("Linux") platforms_str = ", ".join(platforms) or "Unknown" metacritic = data.loc[index, 'metacritic_score'] price = data.loc[index, 'price'] pos = data.loc[index, 'positive'] neg = data.loc[index, 'negative'] total_reviews = pos + neg pos_ratio = f"{(pos / total_reviews * 100):.1f}%" if total_reviews > 0 else "N/A" # Combine into HTML result_html += f"""
Platforms: {platforms_str}
Price: ${price}
Metacritic Score: {metacritic if pd.notnull(metacritic) else "N/A"}
Positive Reviews: {pos_ratio}
{about}