Creating groups of categories


#Figure out good buckets for categories
data.groupby(data["Category ID"]).describe()

data["cat_bucket"] = data["Category ID"].apply(lambda cat:{
    332: "Software",
    52: "Hardware",
    337: "Hardware",
    342: "Software",
    54: "Software",
    341: "Hardware",
    339: "Niche",
    331: "Niche",
    334: "Niche",
    333: "Other",
    338: "Other",
    336: "Other",
    336: "Other",
    335: "Other",
    340: "Other",
    362: "Other"
}.get(cat, ' '))

data.groupby(data["cat_bucket"])["Raised in USD"].describe()

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *