Question: I'm making the latex table with pandas, like:

```
table.to_latex()

```

However,the output table doesn't contain lines, like "\hline" to make the table with actual. As far as I understand that should happen by default but it doesn't and it is not clear how to do that with options.

Any advice would be appreciated, thanks.

Answer: 
Not that I'm particularly proud of it, but the following solution works:

```
def latex_with_lines(df, *args, **kwargs):
    kwargs['column_format'] = '|'.join([''] + ['l'] * df.index.nlevels
                                            + ['r'] * df.shape[1] + [''])
    res = df.to_latex(*args, **kwargs)
    return res.replace('\\\\\n', '\\\\ \\midrule\n')

```

(and can be easily adapted to support the `buf` argument to directly write to file).

Use as

```
latex_repr = latex_with_lines(df)

```
Well it's also not a beauty but I just use csv output like so

```
.to_csv(sep='&', line_terminator="\\\\ \\hline\n",index=False, header=False)

```