Skip to main content

Pure Rust SPSS .sav/.zsav reader with Polars DataFrame output

Project description

ambers

ambers banner

Crates.io PyPI License: MIT

Pure Rust SPSS .sav/.zsav reader — Arrow-native, zero C dependencies.

Features

  • Read .sav (bytecode) and .zsav (zlib) files
  • Arrow RecordBatch output — zero-copy to Polars, DataFusion, DuckDB
  • Rich metadata: variable labels, value labels, missing values, MR sets, measure levels
  • 2–3x faster than pyreadstat
  • Python + Rust dual API from a single crate

Installation

Python:

pip install ambers

Rust:

cargo add ambers

Quick Start

Python

import ambers as am

# Read data + metadata
df, meta = am.read_sav("survey.sav")

# Explore metadata
meta.summary()
meta.describe("Q1")
meta.value("Q1")

# Read metadata only (fast, skips data)
meta = am.read_sav_metadata("survey.sav")

Rust

use ambers::{read_sav, read_sav_metadata};

// Read data + metadata
let (batch, meta) = read_sav("survey.sav")?;
println!("{} rows, {} cols", batch.num_rows(), meta.number_columns);

// Read metadata only
let meta = read_sav_metadata("survey.sav")?;
println!("{}", meta.label("Q1").unwrap_or("(no label)"));

Metadata API (Python)

Method Description
meta.summary() Formatted overview: file info, type distribution, annotations
meta.describe("Q1") Deep-dive into a single variable (or list of variables)
meta.diff(other) Compare two metadata objects, returns MetaDiff
meta.label("Q1") Variable label
meta.value("Q1") Value labels dict
meta.format("Q1") SPSS format string (e.g. "F8.2", "A50")
meta.measure("Q1") Measurement level ("nominal", "ordinal", "scale")
meta.schema Full metadata as a nested Python dict

All variable-name methods raise KeyError for unknown variables.

Streaming Reader (Rust)

let mut scanner = ambers::scan_sav("survey.sav")?;
scanner.select(&["age", "gender"])?;
scanner.limit(1000);

while let Some(batch) = scanner.next_batch()? {
    println!("Batch: {} rows", batch.num_rows());
}

Performance

File Size Rows Cols ambers pyreadstat Speedup
survey_medium.sav 147 MB ~22,000 ~700 1.27s 3.07s 2.4x
survey_large.sav 1.1 GB ~80,000 ~900 2.42s 6.40s 2.6x

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ambers-0.1.4.tar.gz (63.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ambers-0.1.4-cp314-cp314-win_amd64.whl (747.6 kB view details)

Uploaded CPython 3.14Windows x86-64

ambers-0.1.4-cp314-cp314-manylinux_2_34_x86_64.whl (892.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

ambers-0.1.4-cp314-cp314-macosx_11_0_arm64.whl (815.2 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

ambers-0.1.4-cp313-cp313-win_amd64.whl (747.5 kB view details)

Uploaded CPython 3.13Windows x86-64

ambers-0.1.4-cp313-cp313-manylinux_2_34_x86_64.whl (892.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

ambers-0.1.4-cp313-cp313-macosx_11_0_arm64.whl (814.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ambers-0.1.4-cp312-cp312-win_amd64.whl (748.1 kB view details)

Uploaded CPython 3.12Windows x86-64

ambers-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl (893.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

ambers-0.1.4-cp312-cp312-macosx_11_0_arm64.whl (814.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file ambers-0.1.4.tar.gz.

File metadata

  • Download URL: ambers-0.1.4.tar.gz
  • Upload date:
  • Size: 63.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ambers-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9bbaa67fbef60b429719a1e6f1e0e26177d849982790b43811be05b7f7eb9785
MD5 e9d3d9670810abedc5a4c3d70ccb79b9
BLAKE2b-256 803436b5989a6dcf0a74e8c889b50ac1f1325e1f583bf8715af0c75eb3754780

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4.tar.gz:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: ambers-0.1.4-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 747.6 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ambers-0.1.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 0a1b24cdd20a548e1b3b9abab4b69880e7cc9997113800bd9e33a8d1a0f92115
MD5 c1761c271adae87347a3878940717b5a
BLAKE2b-256 3fe5e7990ba94c0d752b2814bdb0d7c6c4257df2f845196c7892d75b43321a58

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp314-cp314-win_amd64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ambers-0.1.4-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bb110fda058452f1bbd2067fb95875ee0088a6581aa18d684faa9ae923902e8f
MD5 f798cdbcbada1aca4242114cc445eaf8
BLAKE2b-256 78842282406fe624e73f30287e44bde920ce095b638a3989ae5bda9bff514db9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp314-cp314-manylinux_2_34_x86_64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ambers-0.1.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f74f80856d03de98bac420c5681cbcfdfe0c27204f5f6b863977d9c02a60c84
MD5 7e9244652a7c83c77813310ab92aaf8a
BLAKE2b-256 8f77b2bf53fd21da5e04704529ffc5d526f7c43c54ab3f04fff64aa97e1d6d85

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: ambers-0.1.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 747.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ambers-0.1.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 aa01132af47616caac7b072202815475effec3994f0def752e92cb65ef33e495
MD5 a8786be010c53cd77f55661fe1025024
BLAKE2b-256 b008c0666819ef55d7670bf8ccd1dafd7fc654e5e2a2a9e6373355720dc211cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp313-cp313-win_amd64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ambers-0.1.4-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 52c4e6afdba2ff2bd79bd731cb3de11354d79144f66b5426ee618a72bd010057
MD5 ca2c7445ea04959f2dcedf004c9d69a5
BLAKE2b-256 9653d82016788bf1b1254f54fa59fa6bf94e9f28e69f7968d0a81e15e8564f25

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ambers-0.1.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d154ec8e9cca03395850f28a7b0b0e0f9f1b2b48d676b6b0f6bd8267233544e3
MD5 d578d9c18abaa8ae8fc6beeffaeaaf9a
BLAKE2b-256 5fc7a7bdd729ef6d4c98e868aee6c68f13c27af73aab93f33ec9d24ddcbba157

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ambers-0.1.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 748.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ambers-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7118c2b9c47fd9cde294211ee0e861db868e09766f4dfed766ba5c945865b04c
MD5 b8e9f838fbf9cb33d6985cbbaca82f33
BLAKE2b-256 ada3d2f1ebc9473d8269466a4299a487d192f3cc0f13abc89e98126c61dccfaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp312-cp312-win_amd64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ambers-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4a8b92733d34d213030c1aa5f877048e7808593ec66891f7c5014929a504788f
MD5 cedb424af6207cb6664f8e5059da0abd
BLAKE2b-256 60cfa53510728b631cebbfbfc6c0f2bbf381b71254ccbeccbc447d56550931b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambers-0.1.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ambers-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c669443db0ac35e2b9ecca0956236244da8e9f0b5df8dc8117359b34e85e843
MD5 9845d71247b93415c4401d4bac1d39df
BLAKE2b-256 dc243984b4a552bdca2aa21e8d8467f4aea8f1457e2e59bba098a4b7cbde8bb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.4-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on albertxli/ambers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page