============
It converts NumPy's arrays into valid LaTeX tables. I use NumPy a lot, and it is always the case that I wanted to convert some array to latex. I wanted something that `imported' in my jupyter notebook such that when I get my results I will directly convert them into LaTeX table (as oppose of converting them into a csv file, and then convert that into LaTeX using other service)
In my thesis, I used `Tables Generator<https://www.tablesgenerator.com>`_ which is really cool and very awesome. But it is not what I wanted, the step of converting into csv, and then uploading to the website was just not the very best way to do that.
Uses
----
First you need to install it via pip using
.. code-block:: python
pip install array2latex
Or using Anaconda, both work just fine, and they will always have the same lates version
.. code-block:: python
conda install -c adonese array2latex
Starting `array2latex` is very simple. It is meant to be integrated with your workflow e.g., working with numpy array and output the final result into `LaTeX` table
.. code-block:: python
from array2latex import tolatex
import numpy as np
# Assuming that you have done some cool stuffs with `NumPy`, you have
# you output and want them to be in latex format
# For me I will just use NumPy random array!
array = np.random.rand(3, 4) # Create 3,4 random matrix
table = tolatex(array, header=header)
# And thats it! You now have a valid LaTeX table.
But there are even more to add. `array2latex` only have 2 required argumets, the array you want to convert (obviously), and the header of your table. You can also sepecify a `caption` of you table, and you can also add a `label` as you would normally do in a typical table in LaTeX. To do that is very simple actually, you just need to do
.. code-block:: python
# Assuming you have imported all the necessary packages, and done you cool stuffs with numpy
array = np.random.rand(3, 4) # Create 3,4 random matrix
table = tolatex(array, header=["col1", "col2", "col3", "col4"], caption="My cool table", label="table:cool-table")
In the previous examples the output will be the stdout, i.e., your `jupyter notebook` or your terminal. However, we also allow you to store the results in a file. To do that
.. code-block:: python
# Assuming you have imported all the necessary packages, and done you cool stuffs with numpy
array = np.random.rand(3, 4) # Create 3,4 random matrix
table = tolatex(array, header=["col1", "col2", "col3", "col4"], caption="My cool table", label="table:cool-table", output_file="somefile.txt") # The extenstion of the file doesn't really matter. It's just a txt file anyway.
So yes this is the whole about `array2latex`.
TODO
-----
- Include Pandas dataframes. I could already done that lazily by detecting the input type and then convert it to numpy and the rest of the code will be unchanged.
- Refactoring the code, etc. It is a must. The code is horrible, yet it works, efficiently? I guess
- Adding comments, using more informative names for variables. I really wish I could found something more informative than string_arry.
- Please, this code is yours, fork it, modify it, pull request, etc. so that we have a better tool to convert NumPy arrays and other arrays into LaTeX tables.
Metadata
Release files for array2latex 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| array2latex-0.5.tar.gz | 2.4 kB | Without provenance | Details for array2latex-0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| array2latex-0.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for array2latex-0.5-py2.py3-none-any.whl |
Total release size: 6.9 kB
Release files / array2latex-0.5.tar.gz
| Download URL | array2latex-0.5.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccb37a29d9ac39624f72b28a42046cfcdb775f5e46fbfa13ce945ab7f289d78d
|
|
BLAKE2b-256 checksum How to use checksums |
e79e3a6bdb25f6e3528a99bc7f552242dbf58add20ac6bb3765057062aebe694
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / array2latex-0.5-py2.py3-none-any.whl
| Download URL | array2latex-0.5-py2.py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
360c8e3eee0ccd597397973b0dcbeb69dc3ab9591b748951f8b90f39a9a7fd31
|
|
BLAKE2b-256 checksum How to use checksums |
ca68da2e8c812f5b05a2bafcb1a907a7f9a8b02358efedd83dca2e48c80e9a22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for array2latex 0.5
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.