Skip to main content

print and extract spss metadata

Project description

SPSS Metadata Printer ๐Ÿ“Š

Easy-to-use Python package for extracting, viewing, and exporting metadata from SPSS files with beautiful formatting.

โœจ Features

  • ๐Ÿ“‹ Pretty-print comprehensive SPSS metadata to console
  • ๐Ÿ’พ Export metadata summaries to text files automatically saved to Downloads
  • ๐Ÿ”„ Support for Pandas and Polars DataFrames
  • ๐Ÿ“Š Detailed variable information including labels, types, and value mappings
  • ๐ŸŽจ Beautiful table formatting with configurable width and display options

๐Ÿš€ Quick Start

Installation

pip install metaprinter

Basic Usage

import pyreadstat
from metaprinter import print_metadata, export_metadata

# Load your SPSS file
df, meta = pyreadstat.read_sav('data.sav')

# Display beautiful metadata summary
summary = print_metadata(df, meta)

# Export to Downloads/metadata_summary.txt
export_path = export_metadata(df, meta)

Output Preview:

============================================================
SPSS FILE METADATA
============================================================
File encoding   : 'UTF-8'
Number of cols  : 25
Number of rows  : 100
Table name      : 'Table'
File label      : 'Customer Satisfaction Survey'
Notes           : 'Notes'

VARIABLE METADATA
============================================================
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ column        โ”† dtype   โ”† column_n โ”† n_uniques โ”† n_categories โ”† column_label        โ”† value_labels        โ”‚
โ”‚ ---           โ”† ---     โ”† ---      โ”† ---       โ”† ---          โ”† ---                 โ”† ---                 โ”‚
โ”‚ str           โ”† str     โ”† i64      โ”† i64       โ”† i64          โ”† str                 โ”† str                 โ”‚
โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ก
โ”‚ respondent_id โ”† Int64   โ”† 1547     โ”† 1547      โ”† 0            โ”† Respondent ID       โ”†                     โ”‚
โ”‚ satisfaction  โ”† Int64   โ”† 1523     โ”† 5         โ”† 5            โ”† Satisfaction Level  โ”† {                   โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "1": "Very Low",  โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "2": "Low",       โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "3": "Neutral",   โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "4": "High",      โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "5": "Very High"  โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”† }                   โ”‚
โ”‚ age           โ”† Int64   โ”† 1534     โ”† 6         โ”† 6            โ”† Age Group Category  โ”† {                   โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "1": "18-25",     โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "2": "26-35",     โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "3": "36-45",     โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "4": "46-55",     โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "5": "56-65",     โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”†   "6": "65+"        โ”‚
โ”‚               โ”†         โ”†          โ”†           โ”†              โ”†                     โ”† }                   โ”‚
โ”‚ ...           โ”† ...     โ”† ...      โ”† ...       โ”† ...          โ”† ...                 โ”† ...                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Advanced Configuration:

# Customize table width for narrow displays
print_metadata(df, meta, max_width=120)

# Control column truncation
print_metadata(df, meta, show_all_columns=False)

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

metaprinter-0.2.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

metaprinter-0.2.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file metaprinter-0.2.1.tar.gz.

File metadata

  • Download URL: metaprinter-0.2.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.9

File hashes

Hashes for metaprinter-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6d85e24e57c67894ff759c18a770af8ab0b1c5ca3b907aa79cfd0c1bc39a0863
MD5 5b0712189981f9a0a76c5f16f0f076e2
BLAKE2b-256 f94d38c92dbd2b8c5530b25e4803379bdb9456f8d59c3a862b026895d340693f

See more details on using hashes here.

File details

Details for the file metaprinter-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for metaprinter-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dec49ff7c9f69dfd0979a0d3bc584bbad9f47df90ebb020870c83b6651b7e374
MD5 20c58946f801ab7e4d9fa584072a3a39
BLAKE2b-256 2fe7f3eafe9ce2f2e2b5de1ff1d4324f866bdb5133d8459ecaa7531c719a24bf

See more details on using hashes here.

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