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.5. 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/datasets.001.

Metadata

Release files for scfpublic 1.0.5

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.5
File Size Uploaded Provenance Actions
scfpublic-1.0.5.tar.gz 52.9 kB With provenance Details for scfpublic-1.0.5.tar.gz

Built distribution (wheel)

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

Total release size: 77.7 kB

Release files / scfpublic-1.0.5.tar.gz

Download URL scfpublic-1.0.5.tar.gz
Size 52.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8320197d9ab8225112f872f24511642c529e69a0c51baa9171f20296a2fc246e
BLAKE2b-256 checksum
How to use checksums
00001c0279ee9b7fcd83648e18767f1271fbccc4f58b85bd7f08058f20a3d2a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

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

Download URL scfpublic-1.0.5-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8968ba02593fc4c4a7b6c90b4d2c2ef1a832fecbb86a4417476ad85cf61ef1d
BLAKE2b-256 checksum
How to use checksums
008847e43139ad4c59c84d874f27085d8f3f71768ee421ad4d25a2055e9a8faa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for scfpublic 1.0.5

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for scfpublic-1.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

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