Fixing Store Counts From Chain Names With Store Numbers
On this page
Problem statement
Count the stores of one chain in the USDA's SNAP retailer list by name and the count comes out wrong, because each store's name carries its store number and the chain is written in several ways. 248,872 retailers have 238,714 distinct names as written. Walmart appears under at least six. The fix is to normalise the name, then map the variants of each chain to one label with a pattern, and check the pattern's matches. This page does both and shows how far the counts move.
Quick answer
Count the distinct names, and look at how Dollar General is written:
raw = snap.Store_Name.value_counts()
print(f"distinct store names as written: {len(raw):,}")
print(snap[snap.Store_Name.str.upper().str.contains("DOLLAR GENERAL", regex=False)].Store_Name.value_counts().head(6).to_dict())
distinct store names as written: 238,714
{'Dollar General': 4, 'Dollar General 3785': 2, 'DOLLAR GENERAL 3139': 2, 'DOLLAR GENERAL 4741': 2, 'Dollar General 30516': 2, 'Dollar General 23433': 2}
There are 238,714 distinct names among 248,872 retailers, so almost every store has a name of its own. Dollar General is written "Dollar General 3785", "DOLLAR GENERAL 3139" and plain "Dollar General", with the store number and the capitalisation varying. value_counts() on the raw name counts stores, not chains.
Turning names into chains
1. Normalise the name
def base(s):
s = s.str.upper().str.replace(r"[^A-Z0-9&' ]", " ", regex=True)
s = s.str.replace(r"\b(STORE|NO|NUMBER)\b", " ", regex=True).str.replace(r"\s+\d[\d ]*$", "", regex=True)
return s.str.replace(r"\s+", " ", regex=True).str.strip()
snap["chain"] = base(snap.Store_Name)
print(f"distinct names after normalising: {snap.chain.nunique():,}")
print(snap.chain.value_counts().head(8).to_string())
distinct names after normalising: 105,359
chain
DOLLAR GENERAL 21067
DOLLARTREE 9199
WALGREENS 7098
FAMILY DOLLAR 7018
CVS PHARMACY 5487
CIRCLE K 4843
ALDI 2715
SPEEDWAY 2672
Upper case, punctuation replaced by spaces, the words STORE and NO removed and the trailing numbers cut: that leaves 105,359 distinct names. Dollar General comes to 21,067, Walgreens 7,098 and CVS Pharmacy 5,487. The normalised name is a good first pass but no more, because it only joins names that differ by number or punctuation.
2. What normalising misses
w = snap[snap.Store_Name.str.upper().str.contains("WALMART|WAL MART|WAL-MART", regex=True)]
print(base(w.Store_Name).value_counts().head(6).to_dict())
{'WALMART': 1787, 'WALMART SUPERCENTER': 1759, 'WALMART NEIGHBORHOOD MARKET': 505, 'WALMART SC': 342, 'WALMART S C': 139, 'WALMART NEIGHBORHOOD MKT': 18}
Normalised, Walmart still has many names. The six commonest are WALMART 1,787, WALMART SUPERCENTER 1,759, WALMART NEIGHBORHOOD MARKET 505, then WALMART SC, WALMART S C and WALMART NEIGHBORHOOD MKT. Some are store formats and some are spellings of one format. Whether "Walmart" means all of them or only the supercentres is a decision the count must state.
3. Map variants to a chain
ALIASES = {"WALMART": r"WAL ?-?MART", "DOLLAR GENERAL": r"DOLLAR GENERAL|^DG\b", "7-ELEVEN": r"7 ?-?ELEVEN|SEVEN ELEVEN", "CVS": r"^CVS", "WALGREENS": r"WALGREEN"}
for k, rx in ALIASES.items():
print(k, f"by exact normalised name {(snap.chain == k).sum():,}; by pattern {snap.Store_Name.str.upper().str.contains(rx, regex=True).sum():,}")
WALMART by exact normalised name 1,787; by pattern 4,589
DOLLAR GENERAL by exact normalised name 21,067; by pattern 21,198
7-ELEVEN by exact normalised name 0; by pattern 8,241
CVS by exact normalised name 1,174; by pattern 7,036
WALGREENS by exact normalised name 7,098; by pattern 7,344
Exact names undercount every chain. WALMART goes from 1,787 to 4,589, CVS from 1,174 to 7,036, and 7-Eleven from 0 to 8,241, because the normalising step turned its hyphen into a space. Dollar General barely moves, 21,067 to 21,198, as its name is short and written consistently. Check a pattern before trusting it: print a sample of its matches, because ^CVS would also take an unrelated "CVS Liquor".
Chain totals by pattern
The data used on this page
The US Department of Agriculture's Food and Nutrition Service (FNS) publishes every store authorised to accept SNAP benefits as the SNAP Retailer Locator data. The copy used here was downloaded from the FNS feature service on 28 October 2026 and saved on this site, because the list changes every day as stores are authorised and withdrawn. Public domain. County and state boundaries, county populations and the 2020 tract centres of population are the Census Bureau's files, public domain. The setup builds snap, a GeoDataFrame of the retailers' points.
from pathlib import Path
import zipfile
import geopandas as gpd
import numpy as np
import pandas as pd
import requests
Path("data").mkdir(exist_ok=True)
# USDA FNS SNAP Retailer Locator data (every authorised retailer), with the Census Bureau's 2024 county estimates,
# 2020 tract centres of population, counties and states. Saved 28 October 2026: the list changes every day as
# stores are authorised and withdrawn.
# Live: https://services1.arcgis.com/RLQu0rK7h4kbsBq5/arcgis/rest/services/snap_retailer_location_data/FeatureServer/0
ARCHIVE = "usda-snap-retailers-2026-10-28.zip"
if not Path(f"data/{ARCHIVE}").exists():
Path(f"data/{ARCHIVE}").write_bytes(requests.get(f"https://data.spatialworkflow.io/{ARCHIVE}", timeout=600).content)
Z = zipfile.ZipFile(f"data/{ARCHIVE}")
for f in ["cb_2024_us_county_20m.zip", "cb_2024_us_state_20m.zip"]:
Path(f"data/{f}").write_bytes(Z.read(f))
snap = pd.read_csv(Z.open("snap-retailers-2026-10-28.csv"), dtype={"Zip_Code": str, "Zip4": str})
snap = gpd.GeoDataFrame(snap, geometry=gpd.points_from_xy(snap.Longitude, snap.Latitude), crs=4326)
print(f"SNAP retailers: {len(snap):,} in {snap.State.nunique()} states and territories")
SNAP retailers: 248,872 in 53 states and territories
Example 1: the largest chains, counted properly
lab = pd.Series(pd.NA, index=snap.index, dtype="object")
for k, rx in ALIASES.items():
lab[snap.Store_Name.str.upper().str.contains(rx, regex=True) & lab.isna()] = k
print(lab.value_counts().to_string())
DOLLAR GENERAL 21198
7-ELEVEN 8241
WALGREENS 7344
CVS 7036
WALMART 4589
With each store given the first chain whose pattern it matches, Dollar General has 21,198 stores, 7-Eleven 8,241, Walgreens 7,344, CVS 7,036 and Walmart 4,589. The order of ALIASES decides a store that two patterns match, so keep the patterns narrow enough that none overlaps.
Internal links
- Dollar stores among SNAP retailers β Dollar General against the supermarkets
- Convenience stores' share β where a food retailer is most likely a gas station
- Reading the SNAP retailer file β the columns, ids and points
- County names that do not join β why the County field needs a spatial join instead
- Fuzzy-matching place names β when no pattern covers the variants
- Cleaning attribute columns β case, whitespace and punctuation