Skip to main content

Classes and scripts to create TLFs (Table, Listing, Figures shells) quickly and in an opinionated way.

Project description

tlfs

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install tlfs

License

tlfs is distributed under the terms of the MIT license.

Example usage

tlf = TLF("Test")
tlf.from_xlsx()
tlf
tlf.to_docx(view = True)


    
# for custom shit do program by hand
# ----------------------------------

# overloading can be useful: * in variables to create Tables
age = Quant("Age")
sex = Quali("Sex", groups = ["M", "F"])
trt = Quali("Treatment", groups = ["EXP", "CTRL"])
prices = Itemset("Unit costs",
                 items = ["Dentist", "Hospice", "Blood test"],
                 contents = ["unit cost", "per", "source"])
nation = Quali("Nation", groups = ["UK", "ITA"])

age * trt
[var * trt for var in [age, sex]] + [prices * nation]


# changing default example
age2 = Quant("Age", display = ["median", "25pct", "75pct"], unit = 'years')
age3 = Quant("Age", display = "median (iqr)", cell_content = "xx (xx - xx)")
sex2 = Quali("Sex", groups = ["M", "F"], display = "n", cell_content = "x")


univ = Section("Univariate tables", [Table(age), Table(sex)])
changed_def = Section("Some changed defaults", [Table(age2), age2 * trt, age3 * trt, Table(sex2)])
listings = Section("Listings", [Table(prices), prices * nation])
tlf2 = TLF("Table, Listings, Figure examples", [univ, biv, changed_def, listings])
tlf.to_doc()


# todo instead of
univ = Section("Univariate tables", [Table(age), Table(sex)])
# just do
univ = Section("Univariate tables", [age, sex])

TODO

  • overload + in Table to stack them
  • overload + in Sections to concatenate them

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

tlfs-0.0.2.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

tlfs-0.0.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file tlfs-0.0.2.tar.gz.

File metadata

  • Download URL: tlfs-0.0.2.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for tlfs-0.0.2.tar.gz
Algorithm Hash digest
SHA256 04298ca68a37519548082346fdb83a345f333b433573408fab56bcadd9bd1526
MD5 c1e6f327187e3c6155f1915c5e0f16e5
BLAKE2b-256 f83b8c54948206024d448617f667ed9f67171d51c24945832e1b960badbc3cb5

See more details on using hashes here.

File details

Details for the file tlfs-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tlfs-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for tlfs-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31e974947ab8ac05113c126d3c73018d48e632de0b9d33605ad0ac7d6aeeb5a3
MD5 9fb799e73c8c8a8fbaa07dfb58ed1cae
BLAKE2b-256 cd0f484bc3f6f2bb18c1175bb290679166fcd327509fb5f48a31e5d9e951f26f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page