Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karlch/pytextable
Create latex tables using pure python
https://github.com/karlch/pytextable
latex python tables
Last synced: 26 days ago
JSON representation
Create latex tables using pure python
- Host: GitHub
- URL: https://github.com/karlch/pytextable
- Owner: karlch
- License: gpl-3.0
- Created: 2020-02-13T12:42:12.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T04:57:05.000Z (almost 2 years ago)
- Last Synced: 2024-11-15T10:23:04.759Z (2 months ago)
- Topics: latex, python, tables
- Language: Python
- Size: 104 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.rst
- Contributing: .github/CONTRIBUTING.rst
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
pytextable - create latex tables using pure python
==================================================.. image:: https://github.com/karlch/pytextable/workflows/CI/badge.svg
:target: https://github.com/karlch/pytextable/actions
:alt: CI
.. image:: https://codecov.io/github/karlch/pytextable/coverage.svg?branch=master
:target: https://codecov.io/github/karlch/pytextable?branch=master
:alt: Codecov
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
:alt: Code style: black**pytextable** creates well-formatted latex tables with booktabs support in pure python.
**pytextable** is highly-configurable, you decide how your table should look.
**pytextable** is small, fast and requires nothing but ``python>=3.6``.
Quick Start Guide
-----------------#. Install
.. code:: console
pip install pytextable
#. Import
.. code:: python
import pytextable
#. Create a latex table from your data :)
.. code:: python
pytextable.write(data, "table.tex")
Example
-------.. code:: python
import pytextable
# This is usually your 2d numpy array or any sequence of sequences
DATA = [[1.2346, 1, 1.2346], [1.2346, 1.2346, 1.2346], [1.2346, 1.2346, 1.2346]]>>> pytextable.tostring(
DATA,
fmt=".3f",
header=("first", "second", "third"),
caption="My fancy pytextable",
label="tab:pytextable",
)
r"""
\begin{table}
\centering
\caption{My fancy pytextable}
\label{tab:pytextable}
\begin{tabular}{ccc}
\toprule
first & second & third \\
\midrule
1.235 & 1.000 & 1.235 \\
1.235 & 1.235 & 1.235 \\
1.235 & 1.235 & 1.235 \\
\bottomrule
\end{tabular}
\end{table}
"""# To write to file use pytextable.write(DATA, filename)
>>> pytextable.write(DATA, "table.tex", fmt=".3f", ...)Links
-----* `Read the full documentation `_.
* `View the changelog `_.License
-------This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with
this program. If not, see .