appliedchemlabwork_tayra.common.csv_to_latex#

appliedchemlabwork_tayra.common.csv_to_latex(file: PathLike[Any] | str) str#

Converts the CSV data into a LaTeX code.

Converts CSV table into LaTeX \tabular environment code via pandas.

Parameters:
file: PathLike | str

The path-like object or the path string to the CSV file to be converted.

Returns:
tex_code: str

The LaTeX code of the table.

Notes

In LaTeX, the table as following:

Header

Header 1

Header 2

Content Content

Content 2 Content 4

Content 3 Content 5

is equivalent to:

Examples

>>> from appliedchemlabwork_tayra import common
>>> common.csv_to_latex('data.csv')
"\\begin{tabular}\n...\\end{tabular}"