-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Latex bugs #20032
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
Latex bugs #20032
Conversation
pandas/io/formats/format.py
Outdated
buf.write('\\begin{{longtable}}{{{fmt}}}\n' | ||
.format(fmt=column_format)) | ||
buf.write('\\toprule\n') | ||
def write_result(self, buf): |
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.
I did some refactoring here and broke this method down into a couple of smaller ones. Ideally, pieces like _rebuild_multi_index()
could also be a bit clearer, but maybe I'll tackle that while looking at some of the other Latex-related bugs.
Also, after going through some of the other Latex-related bugs, I found this discussion about refactoring |
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.
@shangyian so if going to refactor (great idea!). Would you mind doing a pre-cursor PR to split out to separate files, csv.py, html.py, latex.py (just the CSVFormatter and like classes). into separate module. Then should be much cleaner to re-factor this (e.g. you can make module level & static functions easily)
pandas/io/formats/format.py
Outdated
return crow | ||
|
||
def _escape_row(self, row): | ||
def null_replace(x): |
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.
can you add doc-strings to added methods
Hi @shangyian, As part of the discussion I also realised that what you've renamed I have a question about one of your new tests, |
@tomneep - Good catch on the test - not sure why I thought that made sense! As for the multi-indexing portion of the method, yeah, it makes sense to rework that to be clearer. I didn't change much from the original code when I pulled it into |
ok let's rebase this and see where we are |
Codecov Report
@@ Coverage Diff @@
## master #20032 +/- ##
==========================================
- Coverage 91.77% 91.77% -0.01%
==========================================
Files 152 152
Lines 49181 49200 +19
==========================================
+ Hits 45138 45155 +17
- Misses 4043 4045 +2
Continue to review full report at Codecov.
|
Rebased and added some comments. |
…e are using the same function
Not sure if best to do this here, but we discussed combining |
Hello @shangyian! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on March 15, 2018 at 14:20 Hours UTC |
can you rebase / fixup |
closing as stale. if you'd like to continue pls ping. |
closes DataFrame.to_latex() outputs empty cells if MultiIndex names are empty strings #18669
test_to_latex.py
)git diff upstream/master -u -- "*.py" | flake8 --diff