I am unable to visualize the Latex table generated using dataframe.to_latex()
from pandas in my IPython notebook. It shows the exact string with the "\begin.."
line in a box.
I am also curious why the table is formatted {lrrrrr}
and how I can change it columns with lines separating the values like {l|c|c|c|c}
.
I'm not quite sure if my setup is the issue and I am wondering if there are further documentation for formatting Latex rendered tables using pandas.dataframe.to_latex()
. I use IPython notebook (0.132) and Pandas (0.13). I'm running Ubuntu 13.04, Texlive2012.
IPython Notebook code:
df = pd.DataFrame(np.random.random((5, 5)))
print df.to_latex()
IPython notebook output even after copying and running as markdown, only a box around the text is added.
\begin{tabular}{lrrrrr}
\toprule
{} & 0 & 1 & 2 & 3 & 4 \\
\midrule
0 & 0.021896 & 0.716925 & 0.599158 & 0.260573 & 0.665406 \\
1 & 0.467573 & 0.235992 & 0.557386 & 0.640438 & 0.528914 \\
2 & 0.872155 & 0.053389 & 0.419169 & 0.613036 & 0.606046 \\
3 & 0.130878 & 0.732334 & 0.168879 & 0.039845 & 0.289991 \\
4 & 0.247346 & 0.370549 & 0.906652 & 0.228841 & 0.766951 \\
\bottomrule
\end{tabular}
I would appreciate any help as I am still very new to pandas and the wonderful things it can do with the SciPy suite!