79534168

Date: 2025-03-25 15:44:10
Score: 0.5
Natty:
Report link
import pandas as pd

data = {'Name': ["Evil Nights", "Perfect Day", "Unknown Song", "Dead End", "Angel Love", "Home Sweet Home", "The Curse"]}

df = pd.DataFrame(data)

negative_keywords = ["Evil", "Night", "Problem", "Sorrow", "Dead", "Curse"]
positive_keywords = ["Amazing", "Angel", "Perfect", "Sunshine", "Home", "Live", "Friends"]

def categorize_song(name):
    if any(word in name for word in negative_keywords):
        return "Negative"
    elif any(word in name for word in positive_keywords):
        return "Positive"
    else:
        return "Neither"

df["Song Category"] = df["Name"].apply(categorize_song)

print(df)

Ouput:

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Subir Chowdhury