Spaces:
Sleeping
Sleeping
| import pandas as pd | |
| # Load Hackathon Data from CSV | |
| def load_hackathons(csv_file): | |
| df = pd.read_csv(csv_file) | |
| hackathons = [] | |
| for _, row in df.iterrows(): | |
| skills = row["Required Skills"].split(",") # Convert skills from string to list | |
| skills = [skill.strip().title() for skill in skills] # Clean up formatting | |
| hackathons.append({"name": row["Hackathon Name"], "skills": skills}) | |
| return hackathons | |
| # Function to recommend hackathons based on user skills | |
| def recommend_hackathons(user_skills, hackathons): | |
| recommendations = [] | |
| for hackathon in hackathons: | |
| matched_skills = [skill for skill in user_skills if skill in hackathon["skills"]] | |
| if matched_skills: # If at least one skill matches | |
| recommendations.append((hackathon["name"], len(matched_skills))) | |
| # Sort by number of matched skills (Best match first) | |
| recommendations.sort(key=lambda x: x[1], reverse=True) | |
| return [rec[0] for rec in recommendations] | |
| # Load hackathons from the uploaded CSV file | |
| csv_path = r"C:\Users\safal\PycharmProjects\PythonProject\Hackathon_Dataset.csv" | |
| hackathons = load_hackathons(csv_path) | |
| # User manually inputs skills | |
| user_skills = input("Enter your skills (comma-separated): ").split(",") | |
| # Remove extra spaces & standardize formatting | |
| user_skills = [skill.strip().title() for skill in user_skills] | |
| # Get hackathon recommendations | |
| recommended_hackathons = recommend_hackathons(user_skills, hackathons) | |
| # Output results | |
| print("\nYour Skills:", user_skills) | |
| print("Recommended Hackathons:", recommended_hackathons if recommended_hackathons else "No matching hackathons found.") | |