import pandas as pd
import matplotlib.pyplot as plt
RAW = "https://raw.githubusercontent.com/tarunmottlia/mantis/main/data/india-local-business-website-gap-2026/"
cities = pd.read_csv(RAW + "india_city_website_gap_2026.csv")
cells = pd.read_csv(RAW + "india_city_category_website_gap_2026.csv")
print(cities.shape, cells.shape)
cells.head()
Run to view results
total = cities.listings_count.sum()
without = (cities.listings_count * cities.share_without_website).sum()
print(f"listings checked: {total:,}")
print(f"share with no website (pooled): {without / total:.1%}")
Run to view results
c = cities.sort_values("share_without_website")
ax = c.plot.barh(x="city", y="share_without_website", legend=False, figsize=(7, 6), color="#16a34a")
ax.set_xlabel("share of listings with no website")
ax.set_ylabel("")
ax.xaxis.set_major_formatter(lambda v, _: f"{v:.0%}")
plt.tight_layout()
plt.show()
cities.sort_values("share_without_website", ascending=False)[["city", "listings_count", "share_without_website"]]
Run to view results
cells["without_n"] = cells.listings_count * cells.share_without_website
cat = cells.groupby("category").agg(listings=("listings_count", "sum"),
without=("without_n", "sum"),
cities=("city", "nunique"))
cat["share_without_website"] = cat.without / cat.listings
cat = cat[cat.listings >= 300].sort_values("share_without_website", ascending=False)
print("Widest gap:")
display(cat.round(3).head(10))
print("Narrowest gap:")
display(cat.round(3).tail(5))
Run to view results
top = cat.head(12).index
wide = cells[cells.category.isin(top)].pivot_table(index="category", columns="city",
values="share_without_website")
spread = (wide.max(axis=1) - wide.min(axis=1)).sort_values(ascending=False)
spread.round(3)
Run to view results
CITY = "Jaipur"
(cells[cells.city == CITY]
.sort_values("share_without_website", ascending=False)
[["category", "listings_count", "share_without_website"]]
.head(15))
Run to view results