How do I change python pandas LaTeX output formatting? -
i'm trying better format pandas dataframe output.
i have series, convert dataframe , output latex.
meal.to_frame().to_latex('meal.tex')
this yields:
\begin{tabular}{lr} \toprule {} & count \\ \midrule meal & \\ spam & 11723 \\ eggs & 5865 \\ \bottomrule \end{tabular}
how can change \toprule
, \midrule
, \bottomrule
\hline
. , how can name of index name model
appear column header? end result i'm looking is:
\begin{tabular}{lr} \hline meal & count \\ \hline spam & 11723 \\ eggs & 5865 \\ \hline \end{tabular}
you try working tabulate https://pypi.python.org/pypi/tabulate. use python projects time. have 2 different latex styles. it's output string latex code, use custom function replace parts.
if doesn't work, try else to_frame method. data as_matrix()
, add labels , go there.
for custom styling need write simple script build string yourself.
Comments
Post a Comment