Skip to content

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

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

Open
1 task done
Tracked by #6 ...
vimaloctavius opened this issue Dec 17, 2021 · 10 comments
Open
1 task done
Tracked by #6 ...

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

vimaloctavius opened this issue Dec 17, 2021 · 10 comments
Assignees
Labels
Docs IO HTML read_html, to_html, Styler.apply, Styler.applymap

Comments

@vimaloctavius
Copy link

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on master here

Location of the documentation

pandas.DataFrame.to_html (https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.to_html.html?highlight=pandas%20dataframe%20to_html#)

Documentation problem

Came across the documentation for pandas.DataFrame.to_html, found no example

Suggested fix for documentation

Example:

df = pd.DataFrame({'ID': ['XYZ', 'ABC'],
... 'Department': ['HR', 'Admin'],
... 'Job Title': ['Title1', 'Title2']})

print(df.to_html())

ID Department Job Title
0 XYZ HR Title1
1 ABC Admin Title2
@vimaloctavius vimaloctavius added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 17, 2021
@phofl
Copy link
Member

phofl commented Dec 17, 2021

Would you be interested in submitting a pr?

@phofl phofl added IO HTML read_html, to_html, Styler.apply, Styler.applymap and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 17, 2021
@vimaloctavius
Copy link
Author

vimaloctavius commented Dec 18, 2021

Would you be interested in submitting a pr?

Yes, it'll be my first one, I’ll
take it. I've read the guidelines will shout out if I need any help 😊. Thanks

@vimaloctavius
Copy link
Author

take

@vimaloctavius
Copy link
Author

@phofl I've updated the example in my locally cloned repo (pandas/pandas/core/frame.py). How do I test it so I'm sure before submitting the PR. As I'm new to coding space, any help is appreciated. Thanks much!

@phofl
Copy link
Member

phofl commented Dec 23, 2021

You can check the contributing Guide. There is a section about building the docs locally

@vimaloctavius
Copy link
Author

I was able to create the pandas-dev environment. I ran: "python scripts/validate_docstrings.py pandas.DataFrame.to_html" Received the below validation output:
3 Errors found:
No extended summary found
Unknown parameters {'min_rows'}
No examples section found

Please see screenshot attached. In pandas/core/frame.py, I've added the example from Line 2907 onwards.
What am I missing? Thanks!
Screenshot from 2021-12-28 01-00-29

@ParfaitG
Copy link
Contributor

ParfaitG commented Jan 1, 2022

Carefully read the docstring guide, particularly on Examples. Several issues with your attempt:

  • Examples section should be plural, have no colon ending, and a line break before the section.
  • Remove print() for output purposes.
  • Curly {...} braces in DataFrame() constructor must be doubled to escape it as formatting symbol.
  • Previous item unrelated to your addition needs adjustment: remove min_rows lines (deprecated arg).

See other docstrings for guidance.

@vimaloctavius
Copy link
Author

Thank you so much, working on it!

@vvaidy
Copy link
Contributor

vvaidy commented Jul 15, 2023

I'll take this one and push it later tonight assuming i dont hit any problems @noatamir and @phofl

@vvaidy
Copy link
Contributor

vvaidy commented Jul 16, 2023

@phofl ... Pushed the recommended fix (above)

vvaidy pushed a commit to vvaidy/pandas that referenced this issue Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs IO HTML read_html, to_html, Styler.apply, Styler.applymap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants