Package that generates a PDF codebook based on specified data structure and datafile.
Project description
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
- Issues: GitHub Issues
- Discussions: GitHub Discussions
🏗️ 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fadd7d2bb52de3e55f6cd03d81f31a728dbf292ec5eb51bf5cc3be9424f17c8d
|
|
| MD5 |
e67157ccbcd0d0ba17f45f3ba00e81d8
|
|
| BLAKE2b-256 |
037e8b569427a7d47b87dfc1c00264fe14304456e2b70a737cb49601b5e011bc
|
Provenance
The following attestation bundles were made for pypdfcodebook-0.5.2.tar.gz:
Publisher:
release.yml on npr99/pypdfcodebook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypdfcodebook-0.5.2.tar.gz -
Subject digest:
fadd7d2bb52de3e55f6cd03d81f31a728dbf292ec5eb51bf5cc3be9424f17c8d - Sigstore transparency entry: 769413435
- Sigstore integration time:
-
Permalink:
npr99/pypdfcodebook@85fc1da535e1079a00e5870102a4bb0ad713c19f -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/npr99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@85fc1da535e1079a00e5870102a4bb0ad713c19f -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34a1f8d50d6b1533d40d323b972a8f1aa336ff29981122ac07e1d55763d92608
|
|
| MD5 |
1654900db4cecf038d68687a746e02ed
|
|
| BLAKE2b-256 |
186a4d0887c6ae24d8f3fc7994f516dc18e8cb57302b2640872a8fc2c11d6ea6
|
Provenance
The following attestation bundles were made for pypdfcodebook-0.5.2-py3-none-any.whl:
Publisher:
release.yml on npr99/pypdfcodebook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypdfcodebook-0.5.2-py3-none-any.whl -
Subject digest:
34a1f8d50d6b1533d40d323b972a8f1aa336ff29981122ac07e1d55763d92608 - Sigstore transparency entry: 769413467
- Sigstore integration time:
-
Permalink:
npr99/pypdfcodebook@85fc1da535e1079a00e5870102a4bb0ad713c19f -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/npr99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@85fc1da535e1079a00e5870102a4bb0ad713c19f -
Trigger Event:
release
-
Statement type: