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 all commits
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
25 changes: 23 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3133,8 +3133,29 @@ def to_html(

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> df.to_html() # doctest: +SKIP
>>> df = pd.DataFrame(data={'col1': [1, 2], 'col2': [4, 3]})
>>> html_string = '''<table border="1" class="dataframe">
... <thead>
... <tr style="text-align: right;">
... <th></th>
... <th>col1</th>
... <th>col2</th>
... </tr>
... </thead>
... <tbody>
... <tr>
... <th>0</th>
... <td>1</td>
... <td>4</td>
... </tr>
... <tr>
... <th>1</th>
... <td>2</td>
... <td>3</td>
... </tr>
... </tbody>
... </table>'''
>>> assert html_string == df.to_html()
"""
if justify is not None and justify not in fmt._VALID_JUSTIFY_PARAMETERS:
raise ValueError("Invalid value for justify parameter")
Expand Down