Skip to content

BUG: to_latex() output broken when the index has a name #10660

Closed
@jakbaum

Description

@jakbaum

Hey folks,

I posted this on SO and was asked to file a report here as well.

I'm trying to export pandas.DataFrame.describe() to LaTex using the to_latex()-method. This works all fine as long as I don't apply the groupby()-method beforehand. With a grouped DataFrame, the first row has no values, even though its label is count. Note that the first row of a grouped dataframe is used to mark down the variable used for grouping in iPython notebook.

I'm using pandas 0.16.2, python 3.
Is this a bug or am I doing something wrong?

Cheers,
Jakob

Here some examples:

Without groupby:

\begin{tabular}{lr}
\toprule
{} &    IS\_FEMALE \\
\midrule
count &  2267.000000 \\
mean  &     0.384649 \\
...
...
75\%   &     1.000000 \\
max   &     1.000000 \\
\bottomrule
\end{tabular}

enter image description here

With groupby:

\begin{tabular}{llr}
\toprule
  &       &    IS\_FEMALE \\
\midrule
0 & count &              \\     % <-- note missing value here
  & mean &  1134.000000 \\
  & std &     0.554674 \\
...
...
  & 75\% &     0.000000 \\
  & max &     0.000000 \\
\bottomrule
\end{tabular}

enter image description here

Output in the notebook:

enter image description here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions