import pandas as pd import numpy as np import plotly.express as px import plotly.graph_objects as go from plotly.subplots import make_subplots # 1. Dataset Creation data = { "Area_Name": ["Gajuwaka Loop", "NAD Junction", "Maddilapalem", "MVP Colony", "Yendada", "Madhurawada", "Paradesipalem", "Sontyam Loop", "Anandapuram"], "Latitude": [17.6975, 17.7447, 17.7368, 17.7428, 17.7761, 17.8243, 17.8076, 17.8678, 17.9040], "Longitude": [83.2104, 83.2319, 83.3219, 83.3256, 83.3644, 83.3564, 83.3512, 83.2988, 83.3693], "Footfall_Vehicles_Per_Day": [14500, 18200, 16500, 12100, 9800, 11500, 7400, 5200, 8900], "Revenue_2W_INR_k": [120, 150, 140, 110, 95, 105, 75, 60, 80], "Revenue_3W_INR_k": [95, 115, 90, 65, 45, 55, 40, 35, 45], "Revenue_4W_INR_k": [180, 220, 195, 230, 175, 185, 120, 95, 140], "EV_Station_Feasibility_Score": [88, 96, 92, 89, 82, 85, 76, 68, 84], } df = pd.DataFrame(data) df["Total_Daily_Revenue_INR_k"] = df["Revenue_2W_INR_k"] + df["Revenue_3W_INR_k"] + df["Revenue_4W_INR_k"] df["CAC_INR"] = [2500, 3200, 2900, 2800, 2100, 2300, 1800, 1400, 1900] df["CLV_INR"] = [22000, 26000, 24000, 28000, 21000, 23000, 19000, 17000, 20000] # Build 3D Charts fig_3d = px.scatter_3d(df, x="Footfall_Vehicles_Per_Day", y="Total_Daily_Revenue_INR_k", z="EV_Station_Feasibility_Score", color="Area_Name", size="Total_Daily_Revenue_INR_k", title="3D Analysis: Footfall vs Revenue vs Feasibility") x_grid = np.linspace(df["Latitude"].min(), df["Latitude"].max(), 30) y_grid = np.linspace(df["Longitude"].min(), df["Longitude"].max(), 30) X, Y = np.meshgrid(x_grid, y_grid) Z = np.sin(X * 10) * np.cos(Y * 10) * 20 + 75 fig_surface = go.Figure(data=[go.Surface(z=Z, x=X, y=Y, colorscale='Viridis')]) fig_surface.update_layout(title="3D Terrain Surface: Grid Power Accessibility & Feasibility Index") fig_dash = make_subplots(rows=1, cols=2, subplot_titles=("Revenue Breakdown", "CAC vs CLV")) fig_dash.add_trace(go.Bar(x=df["Area_Name"], y=df["Revenue_2W_INR_k"], name="2W"), row=1, col=1) fig_dash.add_trace(go.Bar(x=df["Area_Name"], y=df["Revenue_3W_INR_k"], name="3W"), row=1, col=1) fig_dash.add_trace(go.Bar(x=df["Area_Name"], y=df["Revenue_4W_INR_k"], name="4W"), row=1, col=1) fig_dash.add_trace(go.Scatter(x=df["Area_Name"], y=df["CAC_INR"], name="CAC"), row=1, col=2) fig_dash.add_trace(go.Scatter(x=df["Area_Name"], y=df["CLV_INR"], name="CLV"), row=1, col=2) fig_dash.update_layout(barmode="stack", title_text="Unit Economics") # Combine HTML table_html = df[["Area_Name", "Footfall_Vehicles_Per_Day", "Total_Daily_Revenue_INR_k", "EV_Station_Feasibility_Score"]].to_html(index=False) html_content = f"""

EV Feasibility Dashboard

{table_html}
""" with open("index.html", "w", encoding="utf-8") as f: f.write(html_content) print("index.html created!")