appliedchemlabwork_tayra.common.csv_to_latex#
- appliedchemlabwork_tayra.common.csv_to_latex(file: PathLike[Any] | str) str[source]#
Converts the CSV data into a LaTeX code.
Converts CSV table into LaTeX
\tabularenvironment code viapandas.- Parameters:
- filePathLike | str
The path-like object or the path string to the CSV file to be converted.
- Returns:
- tex_codestr
The LaTeX code of the table.
Notes
In LaTeX, the table as following:
Header
Header 1
Header 2
Content
Content 2
Content 3
Content
Content 4
Content 5
is equivalent to:
\begin{tabular}[|c|c|c|] \hline Header & Header 1 & Header 2\\ \hline Content & Content 2 & Content 3\\ Content & Content 4 & Content 5\\ \hline \end{tabular}
Examples
>>> from appliedchemlabwork_tayra import common >>> common.csv_to_latex('data.csv') "\\begin{tabular}\n...\\end{tabular}"