Generate LaTeX tables with Python
Project description
tabla
Generate LaTeX tables in Python from your data in a pandas.DataFrame
.
Example
All you need is a dataframe you'd like to create a table for, and a list of
TableColumn
s for each column in the dataframe you would like to include in
your table.
import pandas as pd
from tabla import TableColumn, Table
columns = [
TableColumn("date", "", "%Y-%m-%d", "Date"),
TableColumn("temp", "(degrees)", "{:0.2}", "Temperature"),
TableColumn("rate", r"(m day\textsuperscript{-1})", "{:04.3}", "Rate"),
]
dates = pd.date_range("2020-01-01", "2020-01-02", freq="6H")
data = list()
for date in dates:
d = {"date":date}
d.update({c: pd.np.random.random() for c in ["temp", "rate"]})
data.append(d)
df = pd.DataFrame(data)
table = Table("test_name", columns, dataframe, header_units=True)
# Generate as a string
latex_str = table.dumps()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tabla-0.0.1.tar.gz
(5.6 kB
view details)
File details
Details for the file tabla-0.0.1.tar.gz
.
File metadata
- Download URL: tabla-0.0.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fed17ab07408a008bbf1774a3927b995d1da530964db9d344937adfca21f7e8d |
|
MD5 | 51edea1f1e7595065120e56fb142535e |
|
BLAKE2b-256 | 27aaacdc8dfae912a799c276ae69ba784e31ba2ef77b111cf18fbc386f977b8f |