Fixing School Maps Distorted by Virtual Schools

On this page

Problem statement

Sort NCES's school file by enrolment and the largest public schools in the country are not schools anyone walks into. Commonwealth Charter Academy, 29,320 students, has its address in Harrisburg, Pennsylvania; Texas Virtual Academy, 19,731, in Hallsville. Full-time online schools enrol students across a whole state and report them at one office, so on a map every one of those students appears in a single county. A map of students per county or the size of the largest school then shows a virtual school, not the place. This page finds the virtual schools, measures how much they distort county totals, and catches the ones the flag misses.

Quick answer

Rank schools by enrolment and count the full-time virtual ones:

print(sch.nlargest(6, "TOTAL")[["SCH_NAME", "LCITY", "LSTATE", "VIRTUAL", "TOTAL"]].to_string(index=False))
fv = sch[sch.VIRTUAL == "Full Virtual"]
print(f"full-virtual schools: {len(fv):,} with {fv.TOTAL.sum():,.0f} students ({fv.TOTAL.sum() / sch.TOTAL.sum():.1%})")
                           SCH_NAME         LCITY LSTATE              VIRTUAL   TOTAL
    Commonwealth Charter Academy CS    Harrisburg     PA         Full Virtual 29320.0
TEXAS VIRTUAL ACADEMY AT HALLSVILLE    HALLSVILLE     TX         Full Virtual 19731.0
               Ohio Virtual Academy        Maumee     OH         Full Virtual 15339.0
            EPIC CHARTER VIRTUAL HS Oklahoma City     OK         Full Virtual 14517.0
            EPIC CHARTER VIRTUAL ES Oklahoma City     OK         Full Virtual 14019.0
        Highlands Community Charter    Sacramento     CA Supplemental Virtual 11713.0
full-virtual schools: 1,223 with 611,897 students (1.2%)

The five largest schools in the file are all full-time virtual, and the sixth, Highlands Community Charter in Sacramento, is flagged supplemental virtual. In all, 1,223 full-virtual schools enrol 611,897 students, 1.2% of the national total, a small share that is concentrated in a few addresses.

Horizontal bars of the twelve largest public schools, nearly all online: Commonwealth Charter Academy with 29,320 students, Texas Virtual Academy at Hallsville with 19,731 and Ohio Virtual Academy with 15,339. Horizontal bars of the twelve largest public schools, nearly all online: Commonwealth Charter Academy with 29,320 students, Texas Virtual Academy at Hallsville with 19,731 and Ohio Virtual Academy with 15,339.
The largest public schools in the country.

Where virtual students land, and how to find them

1. Where the virtual students are counted

counties = gpd.read_file("data/cb_2024_us_county_20m.zip")
cc = sch.groupby("CNTY").TOTAL.sum().rename("all").to_frame().join(fv.groupby("CNTY").TOTAL.sum().rename("virtual")).fillna(0)
cc["share"] = cc.virtual / cc["all"]
top = cc[cc["all"] > 10_000].sort_values("share", ascending=False).head(6).join(counties.set_index("GEOID")[["NAME", "STUSPS"]])
print(top[["NAME", "STUSPS", "all", "virtual", "share"]].round(3).to_string())
           NAME STUSPS      all  virtual  share
CNTY                                           
48353     Nolan     TX  14455.0  11686.0  0.808
48371     Pecos     TX  14033.0   9278.0  0.661
48203  Harrison     TX  32062.0  19731.0  0.615
42043   Dauphin     PA  72394.0  35041.0  0.484
48471    Walker     TX  12523.0   4924.0  0.393
53047  Okanogan     WA  11538.0   4299.0  0.373

In counties with more than 10,000 students, the distortion is largest in rural Texas. In Nolan County, 80.8% of the students counted are enrolled in full-time virtual schools based there, and in Pecos County 66.1%. In Harrison County, the home of Texas Virtual Academy at Hallsville, it is 61.5%, and in Dauphin County, Pennsylvania, 48.4%. Mapped as students per county, these places look like school districts several times their real size.

Horizontal bars of counties with over 10,000 students where full-virtual schools hold the largest share: Nolan County, Texas, 80.8%, Pecos 66.1%, Harrison 61.5%, Dauphin, Pennsylvania, 48.4%. Horizontal bars of counties with over 10,000 students where full-virtual schools hold the largest share: Nolan County, Texas, 80.8%, Pecos 66.1%, Harrison 61.5%, Dauphin, Pennsylvania, 48.4%.
Counties inflated by virtual schools based there.

2. The VIRTUAL column

print(sch.groupby("VIRTUAL").TOTAL.agg(["size", "sum", "median"]).astype(int).to_string())
print(sch[sch.VIRTUAL == "M"].LSTATE.value_counts().head(4).to_dict())
                                    size       sum  median
VIRTUAL                                                   
Full Virtual                        1223    611897      84
M                                  10222   5797363     484
Not Virtual                        71039  33781621     400
Supplemental Virtual               17235   8957535     418
Virtual with face to face options    518    195108     117
{'TX': 9166, 'ID': 795, 'CA': 224, 'AS': 28}

The VIRTUAL column has five values plus M, missing. M covers 10,222 schools with 5,797,363 students, and almost all of them are in Texas, 9,166 schools, then Idaho and California. For those states the flag cannot be used on its own, and the few Texas schools that do carry one cannot stand for the rest.

3. Name says virtual, flag says not

named = sch.SCH_NAME.str.contains(r"\b(?:virtual|online|cyber|e-?academy|digital)\b", case=False, regex=True)
print(sch[named].VIRTUAL.value_counts().to_string())
print(sch[named & (sch.VIRTUAL == "M")].nlargest(3, "TOTAL")[["SCH_NAME", "LSTATE", "TOTAL"]].to_string(index=False))
VIRTUAL
Full Virtual                         895
Virtual with face to face options    156
Not Virtual                           74
M                                     27
Supplemental Virtual                  18
                    SCH_NAME LSTATE  TOTAL
       IDAHO VIRTUAL ACADEMY     ID 1801.0
          SNAKE RIVER ONLINE     ID 1750.0
iSUCCEED VIRTUAL HIGH SCHOOL     ID 1290.0

The name catches what the flag misses. Of the schools with virtual, online, cyber or digital in their name, 895 are flagged full virtual, but 27 have no flag at all, including Idaho Virtual Academy with 1,801 students and Snake River Online with 1,750, and 74 are flagged as not virtual. Use the flag where it exists and the name where it doesn't, and check the largest schools in each state by hand.

County totals with and without

The data used on this page

NCES's Public School Characteristics layer from the Education Demographic and Geographic Estimates (EDGE) program: the 2024-25 Common Core of Data on EDGE's school points, every record of its ArcGIS service, downloaded on 28 October 2026 and saved on this site, because the "Current" layer is replaced each school year. Public domain. Counts are headcounts reported by state education agencies; teachers are full-time equivalents. County boundaries are the Census Bureau's 2024 cartographic boundary file, public domain.

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)
# NCES EDGE "Public School Characteristics" for 2024-25 (the Common Core of Data on EDGE's school points), EDGE's school
# neighborhood poverty estimates for 2021-22, and the Census Bureau's 2024 counties and states. Saved 28 October 2026:
# the "Current" layers are replaced every school year.
# Live: https://services1.arcgis.com/Ua5sjt3LWTPigjyD/arcgis/rest/services/School_Characteristics_Current/FeatureServer/1
ARCHIVE = "nces-schools-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}")
sch = pd.read_csv(Z.open("school-characteristics-2024-25.csv"), dtype={"NCESSCH": str, "LEAID": str, "CNTY": str, "LZIP": str, "LSTREET2": str})
for f in ["cb_2024_us_county_20m.zip", "cb_2024_us_state_20m.zip"]:
    Path(f"data/{f}").write_bytes(Z.read(f))
print(f"NCES public schools 2024-25: {len(sch):,} records")
sch["LSTATE"] = sch.LSTATE.str.strip()                                    # stored padded to three characters
NUM = ["TOTAL", "FTE", "STUTERATIO", "TOTFRL", "FRELCH", "REDLCH", "DIRECTCERT", "AM", "AS_", "BL", "HP", "HI", "TR", "WH"]
sch[NUM] = sch[NUM].where(sch[NUM] >= 0)                                  # -1 missing, -2 not applicable, -9 below quality standards
sch = sch[sch.SY_STATUS_TEXT.isin(["Open", "New", "Reopened", "Added", "Changed Boundary/Agency"])]
print(f"operating schools: {len(sch):,}; students: {sch.TOTAL.sum():,.0f}")
NCES public schools 2024-25: 101,110 records
operating schools: 100,237; students: 49,343,524

Example 1: students per school in a county, with and without

inp = sch[~sch.VIRTUAL.isin(["Full Virtual"])]
for geoid in ["42043", "39095", "40109"]:
    a, b = sch[sch.CNTY == geoid], inp[inp.CNTY == geoid]
    print(geoid, counties.set_index("GEOID").NAME.get(geoid), f"students {a.TOTAL.sum():,.0f} -> {b.TOTAL.sum():,.0f}; largest school {a.TOTAL.max():,.0f} -> {b.TOTAL.max():,.0f}")
42043 Dauphin students 72,394 -> 37,353; largest school 29,320 -> 1,966
39095 Lucas students 73,661 -> 56,859; largest school 15,339 -> 2,113
40109 Oklahoma students 161,162 -> 127,472; largest school 14,517 -> 2,774

Taking the full-virtual schools out changes the county figures completely. Dauphin County's students fall from 72,394 to 37,353 and its largest school from 29,320 to 1,966. Lucas County, Ohio, home of Ohio Virtual Academy, falls from 73,661 to 56,859, and Oklahoma County from 161,162 to 127,472. For a map of where children go to school, drop the virtual schools or show them as a separate statewide layer; for a state total, keep them.

Paired bars of county enrolment with and without full-virtual schools: Dauphin 72.4 thousand against 37.4, Lucas 73.7 against 56.9, Oklahoma 161.2 against 127.5. Paired bars of county enrolment with and without full-virtual schools: Dauphin 72.4 thousand against 37.4, Lucas 73.7 against 56.9, Oklahoma 161.2 against 127.5.
County enrolment with and without virtual schools.