Spaces:
Sleeping
Sleeping
File size: 1,708 Bytes
33aa265 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
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.")
|