Missing _repr_latex_ method for latex/pdf conversion in jupyter notebooks
State: closed

Hello, this is my very first pull request on github. I added latex/pdf conversion capabilities to the dataframe when used in a Jupyter/Ipython notebook. The method simply uses the existing to_latex method of the Dataframe class. I believe teh following Issues or PR have already attempted this, but they seem closed: #11399 and  #9821

The _repr_latex_ method looks for newly created options:
    - display.latex_escape
    - display.latex_longtable
which are passed as arguments to the to_latex method.

a simple test has been added to check if the conversion works. However, if the
implementation of the to_latex method changes, the test function would also have to be updated.


Labels:
name: IO LaTeX
description: to_latex

Comments:
pls add a whatsnew note, otherwise looks pretty good.

I will make the changes this evening. However, I do not know exactly where to add the whatsnew note. Do I simply edit the  pandas/doc/source/whatsnew/v0.18.0.txt file?

yep

I made the changes. I did not add example code for the Jupyter notebook, because the changes are only visible when the notebook is converted to latex.

@bkasel can you update according to comments

Yes, I will do asap. I don't have a lot of free time right now. (Hopefully the WE will be better)

OK, I think I did the adjustments the way I understood your comments. However there seem to be some conflicts. Is there a way for me to see what the conflicts are?

@bkasel rebasing on latest master should let you solve the conflicts:

```
git fetch upstream
git rebase upstream/master
git push -f
```

I get an error:

```
git fetch upstream
fatal: 'upstream' does not appear to be a git repository
fatal: Could not read from remote repository.
```

you should then replace `upstream` with how you called the pydata/pandas git repository ('upstream' is the canonical name for this). Do `git remote -v` to see a list of those.

I didn't call it anything. I forked the repo on github and the cloned from the forked repo to my laptop.
git remote -v only shows my repo. (Sorry, complete git newbie). I managed to fetch using 

```
git fetch https://www.github.com/pydata/pandas
```

 but I can't rebase

Ah, yes, you have to add this yourself, see also our contributing guide where this is explained: http://pandas.pydata.org/pandas-docs/stable/contributing.html#forking

```
git remote add upstream https://github.com/pydata/pandas.git
```

If you need more help, we also have a dev chat channel: https://gitter.im/pydata/pandas that is sometimes easier for quick help on these things

OK, the rebase was a bit messy, since it is the first one I have done, so I had to fix it. Seems to be OK now. Thanks for your help.

@bkasel rebase did indeed work! We also ask to squash the commits to have a cleaner history, see http://pandas.pydata.org/pandas-docs/stable/contributing.html#combining-commits

I think I did the rebase and squashing succesfully.

squashing should yield 1 commit. you need to push with a `-f` as well.

Yes, I had some trouble getting the squashing done. Should only be a single commit now.

excellent! ping when green.

@jreback ping

thanks!

Nice! Thanks for the help!

@bkasel do you know if there's an easy way to add borders to the output latex table?
@AlJohri I don't have an easy way to do this, since it would require `\hline` commands in the table which would require a modification of the `Dataframe.to_latex` method.