-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Changes from all commits
bce90d5
8c3c11c
43f0de5
59e5db3
cac2c5f
6cfe1dc
31cb410
53c18ac
ab8d853
408cbb6
1f352b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,6 +241,16 @@ class Styler(StylerRenderer): | |
Any, or all, or these classes can be renamed by using the ``css_class_names`` | ||
argument in ``Styler.set_table_classes``, giving a value such as | ||
*{"row": "MY_ROW_CLASS", "col_trim": "", "row_trim": ""}*. | ||
|
||
Examples | ||
-------- | ||
>>> df = pd.DataFrame([[1.0, 2.0, 3.0], [4, 5, 6]], index=['a', 'b'], | ||
... columns=['A', 'B', 'C']) | ||
>>> pd.io.formats.style.Styler(df, precision=2, | ||
... caption="My table") # doctest: +SKIP | ||
|
||
Please see: | ||
`Table Visualization <../../user_guide/style.ipynb>`_ for more examples. | ||
""" | ||
|
||
def __init__( | ||
|
@@ -3492,6 +3502,19 @@ def from_custom_template( | |
MyStyler : subclass of Styler | ||
Has the correct ``env``,``template_html``, ``template_html_table`` and | ||
``template_html_style`` class attributes set. | ||
|
||
Examples | ||
-------- | ||
>>> from pandas.io.formats.style import Styler # doctest: +SKIP | ||
>>> from IPython.display import HTML # doctest: +SKIP | ||
>>> df = pd.DataFrame({"A": [1, 2]}) # doctest: +SKIP | ||
>>> 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it might be minimalist if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure @MarcoGorelli There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
||
Please see: | ||
`Table Visualization <../../user_guide/style.ipynb>`_ for more examples. | ||
""" | ||
loader = jinja2.ChoiceLoader([jinja2.FileSystemLoader(searchpath), cls.loader]) | ||
|
||
|
There was a problem hiding this comment.
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 😄