Skip to main content

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

Project description

ambers

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.3.tar.gz (60.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.3-cp314-cp314-win_amd64.whl (747.8 kB view details)

Uploaded CPython 3.14Windows x86-64

ambers-0.1.3-cp314-cp314-manylinux_2_34_x86_64.whl (892.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

ambers-0.1.3-cp314-cp314-macosx_11_0_arm64.whl (815.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

ambers-0.1.3-cp313-cp313-manylinux_2_34_x86_64.whl (891.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

ambers-0.1.3-cp312-cp312-win_amd64.whl (748.3 kB view details)

Uploaded CPython 3.12Windows x86-64

ambers-0.1.3-cp312-cp312-manylinux_2_34_x86_64.whl (892.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

ambers-0.1.3-cp312-cp312-macosx_11_0_arm64.whl (815.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ambers-0.1.3.tar.gz
  • Upload date:
  • Size: 60.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.3.tar.gz
Algorithm Hash digest
SHA256 3fe3631572092c5ba63b4b9d9d93ce276ff6baabda19c608066442b6878af642
MD5 3843c5178d2ce10f8eb292a22c10b44b
BLAKE2b-256 9c6d1be204c51ba22a6160456bf412525ab8aeaf7dbfd99e1a5bd17ab02c6299

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3.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.3-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: ambers-0.1.3-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 747.8 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.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7269344c49fd7581fe7ab5fba240bdcea0b6f9f39c05e66de63995d2229631e0
MD5 ad9ea59f0a19f264cfd6418ad808e906
BLAKE2b-256 19d2a07dba2d80e958df1a17bdfad1b64fa8b86aad2efec8cb48aebb5997195d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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.3-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ambers-0.1.3-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e1c2b101318d704893e745b8a426b5dfcd9961ad5a3ee975cf5705772f218f50
MD5 c0607439a5ab133bec136573e998bdb6
BLAKE2b-256 0e3499d9a3b08a257c66e39892a2fd14c5b4898fdc811f14c88af88dc7890665

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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.3-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ambers-0.1.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22d5945a972e8624117318220101d25b7077480b2d040f45b0cffe440f5a46a0
MD5 60ca6d0e1bda77cfe13bbf1a6fde7a8a
BLAKE2b-256 34a09d0ef9e0d6393c87791d37f7a5986311a43ba76666757fa56185efb795f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: ambers-0.1.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7102061a7bbf1683a00b585a802efd4d63328cf280d56989100bea5961adbcff
MD5 08c4277fb817074fa09563bdfa4d5511
BLAKE2b-256 f731d195c76028f6d11ed03de6ce8b6c1c644caaca74a52ef7555c7bdd40e75a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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.3-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ambers-0.1.3-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 dabcab5d199bf315ad3bee8d3aa6adf8a940a6479282dd609e3c9020fc40fa2f
MD5 69f917e045dbe7c590e57a85f2932f75
BLAKE2b-256 dea42075964f17e334d203513440fb5cf10aa05c56d0a419c1920493cbeefb2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ambers-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d25949dea7a3ec4f2aa468941dbf599bae4f19c724d46a137eedcdf2de122471
MD5 f67df019018fb3bb269c6e7c455d3ce4
BLAKE2b-256 b558e7ec0c98d7b15d99c1531e8f46a1552d5af9360efd34de70fb08367e699e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ambers-0.1.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 748.3 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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8b2e301318a8da61f3f32f6253227b7415cb4d0d7879301311817e504c0b271c
MD5 8ae1d316bd69552ca292e351ecf96bec
BLAKE2b-256 9490e8ddf82e33e8ccdb80008aa9488b2ea850f1645cf35c50cdddb406ca805a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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.3-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ambers-0.1.3-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b9918450b9cc544cd64ad3eb76fca302f72749379ffc2bc24d25d475a66449a5
MD5 9a4bce60df89d7dc57e86f39e9488b83
BLAKE2b-256 4d1407ffb58091088b7f9ff1a0458b544e9e1a2d5d059b803b1f26200512abec

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ambers-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 163455cf2ff6e8c63dcd04dc4bb9ea099ce2f4861f89bde110cf269a02652ddb
MD5 be26eaa3596bb7476a520e5704fb8d6c
BLAKE2b-256 ddc3b1c3d231560d3192dae0198bdd9a59b1fa8d6816c03e4869407bb1566313

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambers-0.1.3-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