Skip to main content

Python Compiler for Public SCF Files (scfpublic)

Author: Payton Crawford

Last Updated: November 19th, 2026

Table of Contents

Introduction

The purpose of these Python package is to provide a centralized package for downloading the Survey of Consumer Finances files and computing standard errors that are corrected for multiple imputation and the sample design. By doing so, I aim to make it easier and clearer how to properly use SCF data. Please refer to the official Federal Reserve Board website for the Survey of Consumer Finances. Their website includes the datasets, codebooks (for example, 2025) containing information by each year for each of the x-variables, and an updated SAS bulletin macro to define each of the bulletin variables. Additionally, they have a codebook search, a net worth flowchat, materials from previous surveys, and other relevant materials.

Installation

From anywhere in your terminal, run pip install scfpublic. This will run commands from pyproject.toml to install the Python package and its minimum dependencies locally in that environment. From there, you will be able to access any of the Python files in src/scfpublic by running the command import scfpublic at the top of a Python script.

  • The Python dependencies that will be installed are listed in requirements.txt.
  • For further in-depth details on how to utilize the package, please refer to the Jupyter Notebook in examples.

Directory Structure

  • examples

    • Stores Jupyter notebooks detailing how to use each respective package with examples and base Python files showing examples of usage.
  • src/scfpublic

    • Stores the Python files that are used each time the package is imported.
      • scfpublic has the scfpublic package, which is used to load x-data, bulletin, and replicate weights files from their current storages into Python as a Pandas dataframe.
      • cpi.py has the cpi package, which is used for creating the cpiadj and cpilag variables that mimics the SCF bulletin.
      • util.py has the util package, which contains annual and monthly conversion functions following the SCF bulletin.
      • /scfcombo

        • scfcombo.py has the scfcombo package, which is used to convert the SCF data and replicate weights files to compute imputation error, sampling error, and combined errors for user-defined analysis.
        • stats.py has the scfcombo.stats package, which contains convenience wrapper functions around scf_estimate.
  • tests

    • Stores Python test files for each of the above packages.
    • To run the tests for each program, run the command python3 -m pytest {tests directory} in your terminal.
  • variances

    • Stores variances.md details how the combined standard errors are computed and how to use the respective functions for your programming language of choice.

Packages and Functions

  • scfpublic
    • Functions
      • download_year - Loads year, variables, and file type requested for public SCF data
      • download_years - Loads multiple years, variables, and file type requested for public SCF data
      • download_main_extr_years - Loads merged main and extract data using years and variables for public SCF data
    • cpi - Package for adding CPI adjustments by year
      • Functions
        • read_excel_from_url - Reads CPI-U-RS-ALLITEMS Excel file
        • cpi_adjust - Creates cpiadj and cpilag variables by year
    • scfcombo - Package for imputation and sampling error corrections
      • DataClass
        • scfcombo_result - Data class that stores statistic and regression information
          • Functions
            • display - Outputs formatted results to terminal
            • summary - Outputs data class information
      • Functions
        • prepare_scf_data - Prepares SCF data and replicate weights file into a dataset usable for scf_estimate
        • scf_estimate - Takes user functions and outputs pooled estimate, imputation variance, sampling variance, and combined variance into a scfcombo_result object
      • stats - Convenience functions for basic statistics applications using scf_estimate
        • Functions
          • scf_mean - Convenience wrapper for mean estimation around scf_estimate
          • scf_quantile - Convenience wrapper for median estimation around scf_estimate
          • scf_regression - Convenience wrapper for regression estimation around scf_estimate
          • scf_total - Convenience wrapper for aggregate estimation around scf_estimate
    • util - Package for basic SCF functions
      • Functions
        • aconv - Annual conversion function
        • mconv - Monthly conversion function

Citation: Payton Crawford (2026). scfpublic. Python package. ver. 1.0.0. https://github.com/CrawfordPayton/scfpublic.

Bibliography:

 Board of Governors of the Federal Reserve System. (2026). 2025 Survey of Consumer Finances [Dataset]. https://doi.org/10.17016/8799.1.

Metadata

Release files for scfpublic 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scfpublic 1.0.1
File Size Uploaded Provenance Actions
scfpublic-1.0.1.tar.gz 52.6 kB Without provenance Details for scfpublic-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scfpublic 1.0.1
File Interpreter ABI Platform Actions
scfpublic-1.0.1-py3-none-any.whl Python 3 none any Details for scfpublic-1.0.1-py3-none-any.whl

Total release size: 77.4 kB

Release files / scfpublic-1.0.1.tar.gz

Download URL scfpublic-1.0.1.tar.gz
Size 52.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4f7ba6924d592a3159a548536dbe71d509874cdbe95354137baa30724e6c2b9d
BLAKE2b-256 checksum
How to use checksums
710c44f010cf90be8f1b460b2b26725d263fc210d7b8dce80d6454225b22624d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / scfpublic-1.0.1-py3-none-any.whl

Download URL scfpublic-1.0.1-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e0572fffa9b8374608936fa1193a3428b2e1b957e4f0abfed48f2d55eec1b76
BLAKE2b-256 checksum
How to use checksums
6e0cd0d8918c283049d6235b47c30ea08dae2855710e70cf26a23cdfcaf8c3b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for scfpublic 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page