ENC: better pandas typesetting in ipython nbconvert --to latex by lmarti · Pull Request #9821 · pandas-dev/pandas (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation12 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

lmarti

Currently, when IPython notebooks are converted to latex, pandas DataFrames are appear as raw (verbatim) text. One simple solution is to include a _repl_latex_ function. I have tried this solution and works. See ipython/ipython#8261

@lmarti

Currently, when IPython notebooks are converted to latex, pandas DataFrames are appear as raw (verbatim) text. One simple solution is to include a _repl_latex_ function. I have tried this solution and works. See ipython/ipython#8261

@shoyer

shoyer

def _repr_latex_(self):
return self.to_latex()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment to note that this is for ipython? adding a reference to this GH issue would probably also be a good idea.

@jorisvandenbossche

Nice idea indeed, I was only wondering if there is a way to make this configurable? Maybe on the nbconvert side?
As I can imagine you don't always want a full tex table, eg when writing a tutorial where you want to have it look like console input/output

@lmarti

Well, yes... I was thinking of a simple fix... but it would be nice to be able to pass options in the way that you can pass them no to to_latex. Maybe store those options in a singleton and reuse them? Is there any similar situation in pandas?

@shoyer

@jreback

@lmarti can you update with a test and options as described above

@lmarti

@jreback yes! in the next couple of days. Sorry for the delay.

@jreback

@jreback

@lmarti can you add a basic tests for this?

@jreback

@lmarti pls update according to the comments

@jreback

@lmarti can you update according to comments

@lmarti lmarti changed the titlebetter pandas typesetting in ipython nbconvert --to latex ENC: better pandas typesetting in ipython nbconvert --to latex

Oct 21, 2015

@lmarti

I have sent a new PR (#11399) that contains all the requested modifications. Thanks for the wait.