ZipSearch Documentation
ZipSearch is a Python library for US zipcode lookups and geographic data queries. It provides a drop-in replacement for the uszipcode library with significantly improved performance through pre-built RAM indices.
Overview
ZipSearch offers two primary interfaces:
- SearchEngine: Backwards compatible API matching the original uszipcode library
- FastSearchEngine: Optimized API with additional methods for high-performance applications
The library includes comprehensive data for all 42,724+ US zipcodes, including demographic, geographic, and administrative information.
Installation
Quick Start
Basic Usage
Advanced Usage
Migration from uszipcode
ZipSearch maintains full API compatibility with uszipcode. To migrate existing code:
Documentation
API Reference
- FastSearchEngine API - High-performance optimized interface
- Legacy API - Backwards compatible uszipcode interface
- Zipcode Data - Complete field reference and data structure
Core Features
- Direct Lookups: Exact zipcode queries
- Geographic Search: City/state and coordinate-based queries
- Batch Operations: Efficient processing of multiple queries
- Prefix Matching: Find zipcodes by partial matches
- Complete Data: Demographics, boundaries, and administrative information
Performance Characteristics
ZipSearch uses pre-built in-memory indices for fast lookups:
| Operation | Performance |
|---|---|
| Zipcode lookup | ~0.0003ms |
| City/state search | ~0.0005ms |
| Coordinate search | ~0.002ms |
| Initial load time | ~100ms |
| Memory usage | ~50MB |
Data Structure
Each zipcode result includes:
View complete field reference →
Common Use Cases
- Data Processing: ETL pipelines and DataFrame enrichment
- Web Applications: Address validation and geographic lookups
- Analytics: Demographic analysis and geographic research
- APIs: High-throughput zipcode services
Technical Architecture
ZipSearch achieves performance improvements through:
- Pre-built Indices: Data pre-processed into optimized Python dictionaries
- Memory Resident: All data loaded into RAM at startup
- Direct Access: Hash table lookups instead of database queries
- Specialized Indices: Different index structures for different query patterns
The library has no external dependencies and is thread-safe for concurrent access.
Requirements
- Python 3.7+
- No external dependencies
License
MIT License
Getting Started: