Vadhana commited on
Commit
c9c54fe
·
verified ·
1 Parent(s): bd87812

Create enrich.py

Browse files
Files changed (1) hide show
  1. enrich.py +32 -0
enrich.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # enrich.py
2
+ import pandas as pd
3
+ import random
4
+
5
+ # Simulate enrichment for now
6
+ def enrich_company_info(name, website):
7
+ return {
8
+ "LinkedIn Employees": random.randint(10, 1000),
9
+ "Tech Stack": random.choice(["React, Node.js", "PHP, MySQL", "Django, PostgreSQL"]),
10
+ "Funding (USD)": random.choice([None, 500000, 2000000, 10000000]),
11
+ "Glassdoor Rating": round(random.uniform(2.5, 4.9), 1),
12
+ "SSL Secure": website.startswith("https")
13
+ }
14
+
15
+ def score_lead(row):
16
+ score = 0
17
+ if row["LinkedIn Employees"] > 100: score += 20
18
+ if row["Funding (USD)"] and row["Funding (USD)"] > 1000000: score += 30
19
+ if row["Glassdoor Rating"] > 4: score += 20
20
+ if "React" in row["Tech Stack"] or "Django" in row["Tech Stack"]: score += 20
21
+ if row["SSL Secure"]: score += 10
22
+ return score
23
+
24
+ def enrich_and_score(df):
25
+ enriched_data = []
26
+ for _, row in df.iterrows():
27
+ company_info = enrich_company_info(row['Company Name'], row['Website'])
28
+ full_data = {**row, **company_info}
29
+ enriched_data.append(full_data)
30
+ enriched_df = pd.DataFrame(enriched_data)
31
+ enriched_df["Lead Score (0-100)"] = enriched_df.apply(score_lead, axis=1)
32
+ return enriched_df