ColorizeLaTexTables: small script to get color coded latex tables from csv files or pandas DataFrames
Create latex tables that are colored based on rank.
Installation
Install via pip:
pip install colorizelatextables
Dependencies
Only necessary dependency is pandas, seaborn is recommended for color palettes:
pip install pandas
pip install seaborn
Usage:
You can either use the script or use the module
Script
colorize_table.py examples/BigTable.csv bigtable.tex
You can also use seaborn palette names if you have seaborn
colorize_table.py --palette "GnBu_r" examples/BigTable.csv bigtable.tex
Options:
usage: colorize_table.py [-h] [-a] [--precision PRECISION] [-n NRANKS]
[--colors COLORS] [--palette PALETTE] [-f]
[--seperator SEPERATOR] [--columnwise]
inputpath [outputpath]
positional arguments:
inputpath the path to the .csv table
outputpath the path where you want the.tex file
optional arguments:
-h, --help show this help message and exit
-a, --ascending highlight from smallest to largest, default is
descending
--precision PRECISION
decimal precision,default is 3
-n NRANKS, --nranks NRANKS
number of ranks to highlight
--colors COLORS rgb_codes as list of float triples. if you have
seaborn it is recommended to use the --palette option
--palette PALETTE seaborn color palette name
-f, --full creates a complete .tex document, rather than only the
tabular statement
--seperator SEPERATOR
seperator of csv, comma is default
--columnwise calculate columnwise rank rather than rowwise rank
Module
from colorizelatextables import to_colorized_latex
table_string, defined_colors = to_colorized_latex(df, sns.color_palette("GnBu_d",n_colors=3))
You can also provide additional keyword arguments that are passed to pandas to_latex() function, e.g.
table_string, defined_colors = to_colorized_latex(df, sns.color_palette("GnBu_d",n_colors=3), column_format="|c|c|c|c|c|c|c|c|c|")
Metadata
Release files for colorizelatextables 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| colorizelatextables-1.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / colorizelatextables-1.1-py3-none-any.whl
| Download URL | colorizelatextables-1.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69c7d6551d76767f832851d30aace4ce3a85e7f9734f207461fae4782307583d
|
|
BLAKE2b-256 checksum How to use checksums |
8bbc23b60b3a2455ea7004b7b31f690947cdbab374d791b71a65aaa4ef06359b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
|
Security for colorizelatextables 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.