U.S. flag

An official website of the United States government

United States Census Bureau
end of header
LEHD Code Samples

Table of Contents:

  • Introduction
  • LEHD Origin-Destination Employment Statistics (LODES)
  • Post-Secondary Employment Outcomes (PSEO)
  • Appendix
LEHD Code Samples
  • LEHD Code Samples

LEHD Code Samples

Welcome to the documentation for using open source languages to analyze various public-facing datasets. Currently, there are code samples available for the LODES and PSEO datasets. Code samples are forthcoming for QWI, J2J, and VEO. Below you’ll find open-source code samples on how to load, merge, and analyze these datasets. For more information on these datasets, please see the LEHD Website.

Table of Contents:

  • Introduction
    • Data Products
    • Getting Started
  • LEHD Origin-Destination Employment Statistics (LODES)
    • 1. LODES Code Building Blocks
      • 1.1. Loading Data
      • 1.2. Combining and Aggregating Data
      • 1.3. Spatial and Geographic Analysis
      • 1.4. Combining Other Data with LODES
    • 2. A Full LODES Example
      • 2.1. Loading Appropriate Data Files
      • 2.2. Finding Census Blocks Near Metro Stations
      • 2.3. Find Workers with Residence and Workplace Near Metro
  • Post-Secondary Employment Outcomes (PSEO)
    • Reading Data Files
      • Using the Online Directory Structure
      • Using the Census API
    • Visualizing Data Over Time
      • Case Study: Earnings over Time for Graduates in Engineering
      • Case Study: How Many Engineering Graduates Stay in Illinois?
    • State Data Comparisons
      • Case Study: Comparing Earnings in Agriculture Degrees in the Midwest
  • Appendix
    • Software/Packages and Install Instructions
      • Software Versions
      • Python Packages
      • R Packages
      • Installing Packages
    • LODES Schema Files
      • Job Types
      • Labor Market Segments
      • Worker/Job Characteristics
    • Bonus Code Samples
      • Visualizing Blocks around a Point in New Jersey
Next

© Copyright 2025, U.S. Census Bureau.