Skip to content

DOC: Example missing in pandas.DataFrame.to_html #44945 #54153

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

Merged
merged 2 commits into from
Aug 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3133,8 +3133,35 @@ def to_html(

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> df.to_html() # doctest: +SKIP
>>> df = pd.DataFrame({'ID': ['XYZ', 'ABC'],
'Department': ['HR', 'Admin'],
'Job Title': ['Title1', 'Title2']})
>>> print(df.to_html())
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>ID</th>
<th>Department</th>
<th>Job Title</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>XYZ</td>
<td>HR</td>
<td>Title1</td>
</tr>
<tr>
<th>1</th>
<td>ABC</td>
<td>Admin</td>
<td>Title2</td>
</tr>
</tbody>
</table>

Copy link
Member

Choose a reason for hiding this comment

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

Can remove that line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure can, and thanks for your patience as I sort through these processes. Meanwhile, I have two real dumb questions that I hope you can help with ...

  1. I looked but I couldnt see where I can see the diff you pasted abov. Where would I have found that?
  2. I did in fact run the test locally and it appeared to pass. What's the magic incantation so I can run these tests locally before I commit?

OK I lied, I have a third question:
Q3: once I fix appropriately, do I just push into the same branch? I couldnt find a way to generate a new pull request so I assume it automatically knows to rerun the tests on my push, and does it just update the current open pull request?

Thanks again for your patience.

-VV

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I changed the example slightly to be consistent with another example elsewhere in the pandas code and checked it with ci/code_checks.sh docstrings locally and it seems to pass now. Comments welcome, and thanks again to @phofl and @noatamir for help in getting set up at the SciPy 2023 sprint.

"""
if justify is not None and justify not in fmt._VALID_JUSTIFY_PARAMETERS:
raise ValueError("Invalid value for justify parameter")
Expand Down