Metadata-Version: 2.3
Name: tlfs
Version: 0.0.2
Summary: Classes and scripts to create TLFs (Table, Listing, Figures shells) quickly and in an opinionated way.
Project-URL: Documentation, https://github.com/lbraglia/tlfs#readme
Project-URL: Issues, https://github.com/lbraglia/tlfs/issues
Project-URL: Source, https://github.com/lbraglia/tlfs
Author-email: Luca Braglia <lbraglia@gmail.com>
License-Expression: MIT
License-File: LICENSE.txt
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.8
Requires-Dist: docx
Requires-Dist: multimethod
Requires-Dist: numpy
Requires-Dist: pandas
Description-Content-Type: text/markdown

# tlfs

[![PyPI - Version](https://img.shields.io/pypi/v/tlfs.svg)](https://pypi.org/project/tlfs)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tlfs.svg)](https://pypi.org/project/tlfs)

-----

## Table of Contents

- [Installation](#installation)
- [License](#license)

## Installation

```console
pip install tlfs
```

## License

`tlfs` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

## Example usage
``` python
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

