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.1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tlfs-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 eafd64bbe05a290429f181dee1294f67304db68929f0a9880f4436d3c8ea71a1
MD5 97e05002d6b7eda80be90fb78d0b56b4
BLAKE2b-256 617c02215aca2d7c51e12cd436582bbbd4ec54cd8e68d81a553c3d413027208c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tlfs-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fae70af5c1cc92b2f4ef170024b2d18310581017935c97ae6d3c987e8c469f30
MD5 29882669cbd40a4080cbd5ed8195f55e
BLAKE2b-256 92ff595fc701fcdb9de23bc5d73ca54e0b9a3244d3b99445dd15caccf2fcb61b

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