Pandas version checks

  • [X] 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

Comment From: phofl

Would you be interested in submitting a pr?

Comment From: vimaloctavius

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

Comment From: vimaloctavius

take

Comment From: vimaloctavius

@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!

Comment From: phofl

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

Comment From: vimaloctavius

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

Comment From: ParfaitG

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.

Comment From: vimaloctavius

Thank you so much, working on it!

Comment From: vvaidy

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

Comment From: vvaidy

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

Comment From: ArinaKostanyan

Is this still active like there is a need to make changes or the html string directly being outputed is what we need ?