Skip to content

fixed doctest in styler.to_latex #42711

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

Closed
wants to merge 3 commits into from
Closed

fixed doctest in styler.to_latex #42711

wants to merge 3 commits into from

Conversation

willie3838
Copy link
Contributor

@pep8speaks
Copy link

pep8speaks commented Jul 25, 2021

Hello @willie3838! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-07-25 16:19:49 UTC

@willie3838 willie3838 closed this Jul 25, 2021
Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

CC: @attack68

@@ -536,7 +536,18 @@ def to_latex(
>>> df = pd.DataFrame([[1,2], [3,4]])
>>> s = df.style.highlight_max(axis=None,
... props='background-color:red; font-weight:bold;')
>>> s.render()
>>> s.render() #doctest: +ELLIPSIS
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to leave two spaces before the # and one after.

row0 col1" >2</td>\n </tr>\n <tr>\n <th id="..._level0_row1"
class="row_heading level0 row1" >1</th>\n <td id="..._row1_col0"
class="data row1 col0" >3</td>\n <td id="..._row1_col1"
class="data row1 col1" >4</td>\n </tr>\n </tbody>\n</table>\n'
Copy link
Member

Choose a reason for hiding this comment

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

Probably not very useful to have something so big. Maybe add the <style type="text/css">...</style><table ...</table> or something like this helps understand what this is returning in a more concise way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah aha, that 100% makes sense. Will be creating a new pull request since I messed up something in my current repository

@datapythonista datapythonista added Docs Testing pandas testing functions or related to the test suite labels Jul 25, 2021
@attack68
Copy link
Contributor

the reason I suggested this as skip doc test is because this is the docstring for Styler.to_latex but the code example here which is s.render() is generating HTML. It is unnecessary to show the output in this docstring - the code is provided as a comparative example to demonstrate the difference in input between HTML and LaTeX, where users will typically be used to the former.

@datapythonista
Copy link
Member

Thanks @attack68, I missed this was the issue you made the comment to. Happy with that too. Using ellipsis also seems as a reasonable approach to me, also fine, whatever you prefer @willie3838 I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST: Fix doctest in Styler.to_latex
4 participants