-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
ENC: better pandas typesetting in ipython nbconvert --to latex (updated) #11399
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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1428,7 +1428,15 @@ def to_latex(self, buf=None, columns=None, col_space=None, colSpace=None, | |
|
||
if buf is None: | ||
return formatter.buf.getvalue() | ||
|
||
|
||
def _repr_latex_(self): | ||
""" | ||
Used for rendering a DataFrame when converting a Jupyter/IPython notebook to LaTeX. | ||
For other uses refer to the `to_latex` function. | ||
See https://github.com/pydata/pandas/pull/9821 for aditional information. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just in-line whta is necessary here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. your comment contradicts a previous request. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how so? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see #9821 |
||
""" | ||
return self.to_latex() | ||
|
||
def info(self, verbose=None, buf=None, max_cols=None, memory_usage=None, null_counts=None): | ||
""" | ||
Concise summary of a DataFrame. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4752,6 +4752,14 @@ def test_repr(self): | |
self.assertFalse("\t" in repr(df)) | ||
self.assertFalse("\r" in repr(df)) | ||
self.assertFalse("a\n" in repr(df)) | ||
|
||
def test_repr_latex(self): | ||
# #9821 | ||
|
||
df = DataFrame({'A': [1., 2., 3.], | ||
'B': ['a', 'b', 'c']}, | ||
index=np.arange(3)) | ||
self.assertEqual(df._repl_latex_(), df.to_latex()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assert the actual string repr. This isn't testing much. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is out of the scope. I havent programmed the repr. Your statement contradicts one of your previous requests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you aren't testing anything then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know, it was requested at #9821 |
||
|
||
def test_repr_dimensions(self): | ||
df = DataFrame([[1, 2,], [3, 4]]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls move to 0.17.1 whatsnew