A Python package for creating professional PDF codebooks from DataFrames.
- DataFrame support — Works with polars and pandas
- Automatic statistics — Count, missing, unique, mean, std, min, max
- Charts — Bar charts for categorical, histograms for numeric variables
- Value labels — Document coded values (e.g.,
1 = "Male") - Context manager — Auto-save with
with BookIt(...) as book:
pip install bookit-df
# With polars support (recommended)
pip install bookit-df[polars]
# With pandas support
pip install bookit-df[pandas]import polars as pl
from bookit_df import BookIt
df = pl.read_csv("survey_data.csv")
with BookIt("Survey Codebook", output="codebook.pdf", author="Research Team") as book:
book.from_dataframe(
df,
descriptions={
"age": "Respondent's age in years",
"income": "Annual household income (USD)",
},
value_labels={
"gender": {1: "Male", 2: "Female"}
},
suppress_numeric_stats=["gender"],
)
# PDF saved automatically!Full documentation: mostlyunoriginal.github.io/bookit-df