PandaTex is a package to transform Pandas data tables into .tex files
Project description
PandaTex
What is PandaTex?
PandaTex is a package to transform Pandas data tables into .tex files
Getting started
Install the package
To install the package you can use the Pypi using the command
pip install PandaTex
Example
Input
import pandatex as pdtex
import pandas as pd
df = pd.DataFrame({
'Discipline':['Math','Portuguese','Math','Portuguese','Math','Portuguese'],
'Class':['A','A','B','B','C','C'],
'Average Grade':[9.0,6.0,7.3,6.0,9.3,7.5]})
table = pdtex.TexTable(name="AvGrades",caption="Table with the data",label="Table",dataframe=df)
table.printtextable()
Output
\begin{table}[htb!]
\centering
\begin{small}
\caption{Table with the data}\label{Table}
\begin{tabular}{*{4}{|c}|}
\hline
& Discipline & Class & Average Grade \\ \hline
0 & Math & A & 9.0 \\ \hline
1 & Portuguese & A & 6.0 \\ \hline
2 & Math & B & 7.3 \\ \hline
3 & Portuguese & B & 6.0 \\ \hline
4 & Math & C & 9.3 \\ \hline
5 & Portuguese & C & 7.5 \\ \hline
\end{tabular}
\end{small}\end{table}
If you want to generate a .tex file with the dataframe from the example above you can use the method "writetextable"
table.filename = 'myDocs'
table.writetextable()
TexTable
Constructor
TexTable(name= "", filename="Default",label = " ", caption = " ", dataframe = None)
Functions
TexTable.printtextable(**kwargs): This function can be used to print the result of the pandas table in latex format
TexTable.writetextable(**kwargs): This function can be used to write a .tex file with the result of the pandas table in latex format
When printing or writing tables you can use some included arguments to format the table
**kwargs
- coltype (default:"grid" or ["indexed","nogrid"]) This argument controls.
- align (default:"c" or ["l", "r"]) This argument controls the alignment of the data.
- c - align center
- l - align left
- r - align right
- indexed (dtype: boolean, default:True) This argument can be deactivated if the table does not contain indexes.
- hlines (dtype: boolean, default:True) This argument can be deactivated if you want to remove the horizontal lines from the table.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PandaTex-1.0.0.tar.gz.
File metadata
- Download URL: PandaTex-1.0.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6ee8d48f55a9cf4db60ad73a19c7c69c3a1f6e1688800d5d4a4a92d97c3105e
|
|
| MD5 |
b4fc77eedc4e4d8b65c0bf959c158a6f
|
|
| BLAKE2b-256 |
72f6b7883a8ab210f0c5b4e4a5e79cf297d24d76a8b54a859eaabb86650505c2
|
File details
Details for the file PandaTex-1.0.0-py3-none-any.whl.
File metadata
- Download URL: PandaTex-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b03c24fa3ef3ce120c399fd5d35183f004ac4540e08929cbc1c271deefa3afe
|
|
| MD5 |
a1b7a1136ec64991b2ccea1810b13048
|
|
| BLAKE2b-256 |
ef5b5d326b12467277b73c4b3829ccfbd21fd004343de77e52dd7f395c8c99e1
|