Skip to content

DOC: Fixing EX01 - Added examples #54039

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 11 commits into from
Jul 13, 2023
Merged

Conversation

DeaMariaLeon
Copy link
Member

Towards #37875

We need to preview here as html documents for Styler can't be done locally.

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

looks good to me if the preview looks good, leaving open a bit in case @attack68 has comments

Comment on lines +11841 to +11842
>>> df.columns
Index(['A', 'B'], dtype='object')
Copy link
Member

Choose a reason for hiding this comment

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

can't believe there wasn't an example for this 😄

@MarcoGorelli
Copy link
Member

/preview

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

No preview found for PR #54039. Did the docs build complete?

@MarcoGorelli
Copy link
Member

looks like the docs build is failing

/home/runner/work/pandas/pandas/pandas/io/formats/style.py:docstring of pandas.io.formats.style.Styler:134: WARNING: undefined label: 'style.html'
/home/runner/work/pandas/pandas/pandas/io/formats/style.py:docstring of pandas.io.formats.style.Styler.from_custom_template:48: WARNING: undefined label: 'table visualization for more examples <style.html.subclassing'

... caption="My table") # doctest: +SKIP

Please see:
:ref:Table Visualization <../../user_guide/style.ipynb>`_ for more examples.
Copy link
Member

@MarcoGorelli MarcoGorelli Jul 11, 2023

Choose a reason for hiding this comment

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

missing a backtick at the beginning?

:ref:`

Copy link
Member Author

Choose a reason for hiding this comment

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

Embarrassing!

@DeaMariaLeon
Copy link
Member Author

Is this my fault - I wouldn't think so but I can't be sure.

   17 | #warning "Using deprecated NumPy API, disable it with " \
      |  ^~~~~~~```

@MarcoGorelli
Copy link
Member

that's unrelated 😄 I think this one is more related

/home/runner/work/pandas/pandas/pandas/io/formats/style.py:docstring of pandas.io.formats.style.Styler:133: WARNING: Mismatch: both interpreted text role prefix and reference suffix.
/home/runner/work/pandas/pandas/pandas/io/formats/style.py:docstring of pandas.io.formats.style.Styler.from_custom_template:48: WARNING: Mismatch: both interpreted text role prefix and reference suffix.

... caption="My table") # doctest: +SKIP

Please see:
:ref:`Table Visualization <../../user_guide/style.ipynb>`_ for more examples.
Copy link
Member

@MarcoGorelli MarcoGorelli Jul 11, 2023

Choose a reason for hiding this comment

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

I think you don't need 'ref'

See `Table Visualization <../../user_guide/style.ipynb>`_ user guide for

Copy link
Member Author

Choose a reason for hiding this comment

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

🥺

@mroeschke
Copy link
Member

Could you merge in main once more here?

@MarcoGorelli
Copy link
Member

/preview

@github-actions
Copy link
Contributor

Website preview of this PR available at: https://pandas.pydata.org/preview/54039/

@MarcoGorelli MarcoGorelli added this to the 2.1 milestone Jul 13, 2023
@MarcoGorelli MarcoGorelli merged commit 9629b3a into pandas-dev:main Jul 13, 2023
@DeaMariaLeon DeaMariaLeon deleted the Jul6 branch July 14, 2023 08:48
>>> path = "path/to/template" # doctest: +SKIP
>>> file = "template.tpl" # doctest: +SKIP
>>> EasyStyler = Styler.from_custom_template(path, file) # doctest: +SKIP
>>> HTML(EasyStyler(df).to_html(table_title="Another Title")) # doctest: +SKIP
Copy link
Contributor

Choose a reason for hiding this comment

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

I was a bit slow here but I would have commented that the IPython import and the HTML(..) command are unnecessary. Printing HTML and display in a Jupyter notebook would have worked regardless. These additions just obfuscate the example.

Copy link
Member

Choose a reason for hiding this comment

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

thanks @attack68

cool, can we address this as part of a follow-up @DeaMariaLeon please?

Copy link
Contributor

Choose a reason for hiding this comment

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

it might be minimalist if the path and file are moved into the arguments without being pre-defined.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure @MarcoGorelli
Thanks for the review @attack68

Copy link
Member Author

@DeaMariaLeon DeaMariaLeon Jul 17, 2023

Choose a reason for hiding this comment

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

The HTML and importing IPython are also in the User Guide.

Edit: I hope my link works! and marking @MarcoGorelli in case he didn't see this last comment. It's just FYI - not a complain.

Copy link
Contributor

@attack68 attack68 Jul 17, 2023

Choose a reason for hiding this comment

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

The HTML and importing IPython are also in the [User Guide]

They are but are not necessary here, since these documentation examples do not render HTML.

How a user chooses to render the generated HTML produced via Object.to_html, e.g. in a browser file, in Jupyter Notebook, in an Email or a Javascript component, is not within scope for this documentation example.

The User Guide is different. It is written in Jupyter Notebook, so the inclusions of iPython HTML is included to ensure that the correct HTML is rendered within the notebook correctly, and the only reason it is needed is because a keyword argument is passed to the to_html.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok that's clear. What is not clear to me is how useful my Styler examples are when there are not images at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants