-
Notifications
You must be signed in to change notification settings - Fork 4
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
New examples #229
New examples #229
Conversation
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.
Really great job, thank you for making these changes. Left a couple of comments but I think these examples should replace the old ones.
On that note, is there any functionality in the old examples that isn't covered in the penguins examples? The only thing I can think of is the reticulate example - would you be happy to make a penguins equivalent?
gptables/examples/penguins_cover.py
Outdated
"Just another subtitle" | ||
] | ||
penguins_scope = "Penguins" | ||
penguins_source = "Source: Office for Penguin Statistics" |
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.
Maybe actual source for this dataset?
gptables/examples/penguins_cover.py
Outdated
----------------- | ||
|
||
This example demonstrates use of the ``gptables.Cover`` class to create a cover page. This example also | ||
demonstrates the usage of the ``index_columns`` argument and how to create a workbook with multiple sheets. |
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.
Maybe this example should focus on using more than one sheet and not talk about indexing?
iris_summary = iris_summary.pivot_table( | ||
index=["Iris feature", "Average"], columns="index", values="value" | ||
).reset_index() | ||
#Any data processing could go here as long as you end with a Pandas dataframe that you want to write in a spreadsheet |
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.
Much better to replace the wrangling with a comment, thank you for doing this
#To format cells using the set_row or set_column functions we must use a workbook to create a format object | ||
italic_format=wb.add_format({"italic":True}) | ||
ws.set_column(2,3,10,italic_format) #Sets the width of the third and fourth column and makes them italic | ||
|
||
#Note that the first two arguments of set_column are the first and last columns (inclusive) you want to format as opposed | ||
#to set_row which only affects a single row at a time (the first argument). | ||
|
||
# Finally use the close method to save the output |
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.
Really helpful addition
# or use kwargs to pass these to the appropriate parameters | ||
# kwargs = { | ||
# "table_name": penguins_table_name, | ||
# "title": penguins_title, | ||
# "subtitles": penguins_subtitles, | ||
# "scope": penguins_scope, | ||
# "source": penguins_source, | ||
# } | ||
#penguins_table = gpt.GPTable(table=penguins_data, **kwargs) would also be valid |
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.
Maybe cut this for the minimal example?
Where you wish to provide no metadata in required parameters, use ``None``. | ||
|
||
The theme parameter must take either a directory or a yaml file in the ``gptables.write_workbook`` function. | ||
The yaml file used in this example can be found in the themes folder as ''penguins_test_theme.yaml''. |
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.
Is the theme used for testing? If not, let's swap test
for example
or just remove it
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.
In general looks great. I think it's worth keeping the custom theme example but otherwise I'm good with these changes 👍
:language: R | ||
|
||
R users may also be interested in the `a11ytables <https://co-analysis.github.io/a11ytables/>`_ | ||
However we recommend use of the `a11ytables <https://co-analysis.github.io/a11ytables/>`_ |
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.
I think this is a good recommendation
@@ -0,0 +1,58 @@ | |||
""" | |||
Penguins - Cover Page |
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.
Copy paste error?
Penguins - Cover Page | ||
----------------- | ||
|
||
This example demonstrates how to create a workbook with multiple sheets. |
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.
Consider adding a comment to explain that a table of contents will be autogenerated
gptables/examples/penguins_theme.py
Outdated
@@ -9,8 +9,7 @@ | |||
Where you wish to provide no metadata in required parameters, use ``None``. | |||
|
|||
The theme parameter must take either a directory or a yaml file in the ``gptables.write_workbook`` function. | |||
The yaml file used in this example can be found in the themes folder as ''penguins_test_theme.yaml''. | |||
The personalised theme removes any bold or italics from the table. | |||
The yaml file used in this example can be found in the themes folder as ''gptheme.yaml''. |
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.
I think it is worth keeping a separate theme for this example, because I'd like to avoid people editing the default theme (both for good practice and because it's actually protected and might confuse people)
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.
Thanks for making these final changes, this looks great
No description provided.