Python · Lead-Datengenerierung
Code
import pandas as pd import numpy as np np.random.seed(202) N = 18600 records = [] for i in range(N): # Käufer-Profil alter = np.random.normal(42, 12) haushalt = np.random.choice(['Single','Paar','Familie','Investor'], p=[0.20,0.30,0.35,0.15]) finanzierung = np.random.choice(['Bestätigt','In Bearbeitung','Unklar','Keine'], p=[0.15,0.25,0.35,0.25]) # Verhaltenssignale anfragen_gesamt = np.random.poisson(5) tage_seit_erstanfrage = np.random.exponential(30) expose_views = np.random.poisson(4) rueckfragen = np.random.poisson(1.2) besichtigung_angefragt = np.random.random() < 0.32 antwortzeit_min = np.random.exponential(180) wochenende_anfrage = np.random.random() < 0.35 nachricht_laenge = np.random.poisson(45) eigene_immobilie = np.random.random() < 0.40 preisbudget_match = np.random.uniform(0.5, 1.3) # Conversion-Modell score = 0.05 if finanzierung == 'Bestätigt': score += 0.25 elif finanzierung == 'In Bearbeitung': score += 0.12 if rueckfragen >= 2: score += 0.15 if antwortzeit_min < 60: score += 0.10 if nachricht_laenge > 60: score += 0.08 if 0.9 <= preisbudget_match <= 1.1: score += 0.12 if eigene_immobilie: score += 0.06 if besichtigung_angefragt: score += 0.10 if anfragen_gesamt > 8: score -= 0.08 # Touristen hat_gekauft = np.random.random() < np.clip(score, 0.02, 0.65) records.append({ 'lead_id': f'L-{i+1:05d}', 'alter': int(np.clip(alter,22,72)), 'haushalt': haushalt, 'finanzierung': finanzierung, 'anfragen_gesamt': anfragen_gesamt, 'expose_views': expose_views, 'rueckfragen': rueckfragen, 'besichtigung_angefragt': besichtigung_angefragt, 'antwortzeit_min': round(antwortzeit_min), 'nachricht_laenge': nachricht_laenge, 'eigene_immobilie': eigene_immobilie, 'preisbudget_match': round(preisbudget_match,2), 'wochenende_anfrage': wochenende_anfrage, 'tage_aktiv': int(tage_seit_erstanfrage), 'hat_gekauft': hat_gekauft, }) df = pd.DataFrame(records) conv_rate = df['hat_gekauft'].mean() print(f"Leads: {len(df):,} | Conversions: {df['hat_gekauft'].sum():,} | Rate: {conv_rate*100:.1f}%")