Skip to main content

Package that generates a PDF codebook based on specified data structure and datafile.

Project description

PyPI version Python License: MPL 2.0 DOI

pyPDFCodebook Logo

pypdfcodebook

pyPDFCodeBook helps researchers and data professionals create clear, attractive codebooks for tabular datasets. Codebooks document essential metadata—project descriptions, data provenance, variable definitions, and summaries—ensuring your data is understandable and reproducible. While datasets contain values, they rarely explain what each column or row represents. Codebooks fill this gap by providing structured, self-explanatory documentation. They reinforce best practices such as tidy data, unique keys, and transparent variable origins. With pyPDFCodeBook, generating a professional, easy-to-read codebook takes just a few clicks—laying the foundation for good data science and reproducible research.

Remember: You are your number one data user, so help your future self out and document your metadata.

🚀 Features

  • Professional PDF Generation: Create polished, publication-ready codebooks
  • Comprehensive Metadata: Include project descriptions, data source information, and variable definitions

📦 Installation

Install pypdfcodebook from PyPI using pip:

pip install pypdfcodebook

🔧 Quick Start

Here's a simple example to get you started:

from pypdfcodebook.pdfcb_03c_codebook import codebook
import pandas as pd

# Load your data
data = pd.read_csv('your_data.csv')

# Create a basic codebook (saves to current directory)
cb = codebook(
    input_df=data,
    datastructure={},  # Your data structure dictionary
    projectoverview='',  # Path to markdown file or empty string
    keyterms='',  # Path to markdown file or empty string 
    output_filename='my_codebook'
    # header_title is optional - defaults to "Data Codebook"
    # outputfolder is optional - defaults to current directory
)

# Generate the PDF codebook
cb.create_codebook()

📖 Usage

Basic Codebook (Current Directory)

from pypdfcodebook.pdfcb_03c_codebook import codebook

# Minimal setup - output saves to current directory
cb = codebook(
    input_df=your_dataframe,
    datastructure=your_data_structure,
    projectoverview='',
    keyterms='',
    output_filename='your_codebook'
    # header_title defaults to "Data Codebook"
)
cb.create_codebook()

Custom Output Directory

# Specify custom output directory and title
cb = codebook(
    input_df=your_dataframe,
    header_title='Your Project Name',  # Optional: custom title
    datastructure=your_data_structure,
    projectoverview='',
    keyterms='',
    output_filename='your_codebook',
    outputfolder='./custom_output_folder/'
)
cb.create_codebook()

Advanced Configuration

# Full configuration with all options
cb = codebook(
    input_df=your_dataframe,
    header_title='Comprehensive Study',
    datastructure=your_data_structure,
    projectoverview='path/to/overview.md',
    keyterms='path/to/keyterms.md',
    output_filename='comprehensive_codebook',
    outputfolder='./output/',
    footer_image_path='path/to/logo.png'
)
cb.create_codebook()

📚 Documentation

For comprehensive documentation, examples, and tutorials, visit our documentation site.

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details on how to get started.

📄 License

This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.

📮 Support

🏗️ Requirements

  • Python 3.9+
  • pandas >= 2.2.0
  • numpy >= 1.26.0
  • fpdf2 >= 2.7.0
  • pillow >= 12.0.0
  • seaborn >= 0.12.0

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

pypdfcodebook-0.5.2.tar.gz (529.2 kB view details)

Uploaded Source

Built Distribution

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

pypdfcodebook-0.5.2-py3-none-any.whl (523.5 kB view details)

Uploaded Python 3

File details

Details for the file pypdfcodebook-0.5.2.tar.gz.

File metadata

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

File hashes

Hashes for pypdfcodebook-0.5.2.tar.gz
Algorithm Hash digest
SHA256 fadd7d2bb52de3e55f6cd03d81f31a728dbf292ec5eb51bf5cc3be9424f17c8d
MD5 e67157ccbcd0d0ba17f45f3ba00e81d8
BLAKE2b-256 037e8b569427a7d47b87dfc1c00264fe14304456e2b70a737cb49601b5e011bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypdfcodebook-0.5.2.tar.gz:

Publisher: release.yml on npr99/pypdfcodebook

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

File details

Details for the file pypdfcodebook-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: pypdfcodebook-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 523.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypdfcodebook-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 34a1f8d50d6b1533d40d323b972a8f1aa336ff29981122ac07e1d55763d92608
MD5 1654900db4cecf038d68687a746e02ed
BLAKE2b-256 186a4d0887c6ae24d8f3fc7994f516dc18e8cb57302b2640872a8fc2c11d6ea6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypdfcodebook-0.5.2-py3-none-any.whl:

Publisher: release.yml on npr99/pypdfcodebook

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