python - How to output a multi-index DataFrame in latex with pandas? -
i trying output multi-index dataframe in latex output using python , pandas. far, have this: import pandas pd l = [] in ['1', '2', '3']: b in ['first', 'second']: c in ['one', 'two']: x = 3.2 s = pd.series({'a':a, 'b':b, 'c':c, 'x':x}) l.append(pd.dataframe(s).transpose()) df = pd.concat(l, ignore_index=true) df = df.set_index(['a', 'b', 'c']) print(df) print(df.to_latex()) however, not have expected output. x b c 1 first 1 3.2 2 3.2 second 1 3.2 2 3.2 2 first 1 3.2 2 3.2 second 1 3.2 2 3.2 3 first 1 3.2 2 3.2 second 1 3.2 2 3.2 \begin{tabular}{llll} \toprule & & & x \\ \midrule 1 & first & 1 & \\ 2 & second & 2 & 3.2 \\ \bottomrule \end{tabular} is bug or ...