How to Read NCES Public School Data in Python

On this page

Problem statement

The National Center for Education Statistics (NCES) publishes a record for every public school in the United States: 101,110 rows for 2024-25, each with its name, district, address, grades, level, locale, enrolment, teachers, free-lunch counts and students by race, and a point location from NCES's EDGE program. It is the standard source for any map or count of American schools. It also carries traps that a first read misses: state codes padded with a space, rows for schools that have closed or not yet opened, and the numbers -1, -2 and -9 in count columns. This page reads it, checks the ids and statuses, and builds points.

Quick answer

Strip the padded state codes and build points from LONCOD and LATCOD, which are in NAD83:

sch["LSTATE"] = sch.LSTATE.str.strip()
g = gpd.GeoDataFrame(sch, geometry=gpd.points_from_xy(sch.LONCOD, sch.LATCOD), crs=4269)
print(g[["NCESSCH", "SCH_NAME", "LCITY", "LSTATE", "SCHOOL_LEVEL", "TOTAL", "FTE"]].head(3).to_string(index=False))
print(f"{len(g):,} schools in {g.LSTATE.nunique()} states and territories")
     NCESSCH                        SCH_NAME       LCITY LSTATE SCHOOL_LEVEL  TOTAL  FTE
010000500870       Albertville Middle School Albertville     AL       Middle    849 43.0
010000500871         Albertville High School Albertville     AL         High   1244 66.5
010000500879 Albertville Intermediate School Albertville     AL       Middle    843 42.0
101,110 schools in 56 states and territories

The first rows are schools in Albertville, Alabama: a middle school of 849 students with 43 full-time-equivalent teachers, a high school of 1,244 with 66.5. The file has 101,110 schools in 56 states and territories: the 50 states, DC, Puerto Rico and four island territories. LSTATE is stored as three characters, "AL " with a trailing space, so a filter on "AL" matches nothing until it is stripped.

Dot map of every operating public school in the lower 48 coloured by locale: city schools in red clusters, suburbs in blue around them, towns and rural schools spread across the countryside. Dot map of every operating public school in the lower 48 coloured by locale: city schools in red clusters, suburbs in blue around them, towns and rural schools spread across the countryside.
Every operating public school in the lower 48, 2024-25, by locale.

Reading the file

1. Ids

print(f"NCESSCH unique: {sch.NCESSCH.is_unique}; lengths: {sch.NCESSCH.str.len().value_counts().to_dict()}")
print(f"NCESSCH starts with LEAID: {(sch.NCESSCH.str[:7] == sch.LEAID).mean():.1%}; districts: {sch.LEAID.nunique():,}")
NCESSCH unique: True; lengths: {12: 101110}
NCESSCH starts with LEAID: 100.0%; districts: 18,495

NCESSCH, the 12-digit school id, is unique and always begins with the 7-digit LEAID of the school's district, so the district can be read from the school id. Read both as strings: as numbers, the leading zeros of Alabama and the other low-numbered states disappear and the ids no longer join to other NCES files. The schools belong to 18,495 districts.

2. Which schools are operating

print(sch.SY_STATUS_TEXT.value_counts().to_string())
print(sch.groupby("SY_STATUS_TEXT").TOTAL.apply(lambda s: (s > 0).sum()).to_string())
SY_STATUS_TEXT
Open                       99259
New                          872
Inactive                     501
Future                       372
Changed Boundary/Agency       48
Added                         34
Reopened                      24
SY_STATUS_TEXT
Added                         20
Changed Boundary/Agency       45
Future                         0
Inactive                       0
New                          735
Open                       95754
Reopened                      17

Not every row is a school in operation. 99,259 are open and 872 new this year, but 501 are inactive and 372 are future schools that have not opened, and none of those 873 has students. The pages in this cluster keep the open, new, reopened, added and changed schools: 100,237 in all.

Horizontal bars on a log scale of records by status: 99,259 open, 872 new, 501 inactive, 372 future, and a few dozen changed, added or reopened. Horizontal bars on a log scale of records by status: 99,259 open, 872 new, 501 inactive, 372 future, and a few dozen changed, added or reopened.
Records by school-year status; inactive and future schools have no students.

3. Codes that are not numbers

for c in ["TOTAL", "FTE", "TOTFRL", "DIRECTCERT"]:
    print(c, sch[c].where(sch[c] < 0).value_counts().sort_index().to_dict())
TOTAL {-9.0: 54, -2.0: 1662, -1.0: 149}
FTE {-9.0: 100, -2.0: 873, -1.0: 3963}
TOTFRL {-9.0: 4953, -2.0: 7212, -1.0: 8532}
DIRECTCERT {-9.0: 1662, -2.0: 7212, -1.0: 42192}

Count columns hold negative codes where there is no number: -1 for missing, -2 for not applicable and -9 for a value that failed NCES's quality checks. 1,662 schools have -2 in TOTAL, and direct certification, which many states do not report, has 42,192 entries of -1. Summing a column without removing them understates every total; the codes page measures by how much.

4. The points

print(g.total_bounds.round(2))
fifty = g[~g.LSTATE.isin(["PR", "GU", "VI", "AS", "MP", "BI"])]
print(f"outside the 50 states and DC: {len(g) - len(fifty)}; by territory: {g[~g.index.isin(fifty.index)].LSTATE.value_counts().to_dict()}")
[-174.2   -14.35  145.78   71.3 ]
outside the 50 states and DC: 991; by territory: {'PR': 862, 'GU': 45, 'MP': 35, 'AS': 28, 'VI': 21}

The points run from Atka in the Aleutians at 174.2Β° W to Saipan at 145.8Β° E, and from American Samoa at 14.35Β° S to Alaska's north coast at 71.3Β° N. 991 schools lie outside the 50 states and DC, 862 of them in Puerto Rico, so a map of the lower 48 should filter by state rather than trust a bounding box drawn around the data.

Counts by state and level

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.

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")
NCES public schools 2024-25: 101,110 records

Example 1: schools and students by state

op = sch[sch.SY_STATUS_TEXT.isin(["Open", "New", "Reopened", "Added", "Changed Boundary/Agency"])]
by = op.assign(students=op.TOTAL.where(op.TOTAL >= 0)).groupby("LSTATE").agg(schools=("NCESSCH", "size"), students=("students", "sum"))
print(by.sort_values("students", ascending=False).head(6).astype(int).to_string())
print(f"all: {len(op):,} operating schools, {by.students.sum():,.0f} students")
        schools  students
LSTATE                   
CA        10305   5790305
TX         9192   5545640
FL         4187   2856531
NY         4810   2503633
IL         4399   1843051
GA         2329   1744185
all: 100,237 operating schools, 49,343,524 students

The 100,237 operating schools enrol 49,343,524 students. California leads with 10,305 schools and 5,790,305 students, then Texas, Florida, New York, Illinois and Georgia. New York has more schools than Florida but fewer students: its schools are smaller.

Horizontal bars of students by state for the twelve largest: California 5.79 million, Texas 5.55 million, then Florida, New York, Illinois and Georgia. Horizontal bars of students by state for the twelve largest: California 5.79 million, Texas 5.55 million, then Florida, New York, Illinois and Georgia.
Public school students by state, the twelve largest.

Example 2: school level

t = op.assign(students=op.TOTAL.where(op.TOTAL >= 0)).groupby("SCHOOL_LEVEL").agg(schools=("NCESSCH", "size"), median_students=("students", "median"))
print(t.sort_values("schools", ascending=False).to_string())
                 schools  median_students
SCHOOL_LEVEL                             
Elementary         52809            412.0
High               23829            369.0
Middle             16249            519.0
Other               4535            173.0
Prekindergarten     1626            100.0
Not Reported         411              NaN
Secondary            391             27.0
Not Applicable       281              3.0
Ungraded              98              0.0
Adult Education        8              0.0

Elementary schools are more than half of all schools, 52,809, with a median of 412 students. Middle schools are the largest, 519 at the median, and high schools smaller than expected at 369, because the level includes thousands of small alternative, career and technical, and special education high schools; regular high schools are much larger. "Other", "Not Applicable" and "Ungraded" are mostly special programmes with few or no students of their own; the 411 schools whose level is "Not Reported" have no enrolment figure at all.