Skip to content

DOC: Add information about StyleFrame, to format Excel output #47533

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

Closed
wants to merge 3 commits into from
Closed

DOC: Add information about StyleFrame, to format Excel output #47533

wants to merge 3 commits into from

Conversation

INDIG0N
Copy link
Contributor

@INDIG0N INDIG0N commented Jun 28, 2022

Closes #47525
The issue mentions altering the ecosystem page on the pandas website, do you guys know how I would go about doing that?

@@ -2189,6 +2189,9 @@ def to_excel(
Once a workbook has been saved it is not possible to write further
data without rewriting the whole workbook.

If you'd like to be more flexible with the output formatting,
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in #47525 (comment), you can update the ecosystem docs in doc/source/ecosystem.rst to mention StyleFrame and then use a Sphix reference to mention there are ecosystem packages to help with output formatting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, tahnks. I added the package to the ecosystem doc and used a Sphinx reference in the docstring.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like StyleFrame needs to be referenced in that doc somewhere

@datapythonista datapythonista changed the title added note about StyleFrame in to_excel docstring DOC: Add information about StyleFrame, to format Excel output Jun 29, 2022
@datapythonista
Copy link
Member

Thanks @INDIG0N. The idea would be to add a section for StyleFrame in our Ecosystem page in the web.

I personally don't see how we can add a useful note to the to_excel docstring if we don't link to the project (which seems reasonable). I don't think it makes a lot of sense adding to the docstring "Check the ecosystem page for packages that can be useful" or "There is a package to add formatting to the exported Excel files, but you need to check the Ecosystem page". If we don't want to link third-party packages we don't know much about in our docs other than the Ecosystem, I think let's just add the entry to the Ecosystem page.

You can see other entries in Ecosystem to see what's expected to be added.

@datapythonista datapythonista added the Web pandas website label Jun 29, 2022
@INDIG0N
Copy link
Contributor Author

INDIG0N commented Jun 29, 2022

Makes sense, I'll go ahead and take out the changes to the docstring.

@attack68
Copy link
Contributor

The StyleFrame documentation does not make it clear to me the specific features, in particular the specific features beyond pandas.Styler own capabilities, which for example can already style:

  • background colors,
  • text colors,
  • font styles,
  • borders,
  • number formats,

I think if we add a third party library to ecosystem, it would be worthwhile stating what it can do, extra, that pandas cannot.

In particular that warrants the use of the phrase "easier styling", which, currently, I am skeptical of.

@datapythonista
Copy link
Member

I'm not aware of pandas providing much functionality for exporting an excel file with colors, number formats... StyleFrame is a replacement for to_excel that does provide a way to set all the formats in a wrapper of a DataFrame that then can be exported to an Excel file.

I agree that just saying "easier styling" can be improved, but I think it's worth having it in our ecosystem.

@INDIG0N do you mind expanding the description a bit to make it clear for readers what StyleFrame is about? I think this PR is ready just having a bit clearer description. Also, if you want to write a very short example, that could also help. You have one here: https://github.com/DeepSpace2/StyleFrame#simple-example I think we should have a much simpler one, maybe with just one column and changing the background color or something. But if it's complex, just with a bit clearer description is also fine.

And sorry it's taking quite long to review this PR.

@attack68
Copy link
Contributor

Exporting from Styler to Excel is documented in the Table Visualization user guide. It includes coloring, borders and fonts for headers, index and data cells. It can also write the excel number format directly. The conditional formatting tools are all directly tied into Styler.

Im not against including StyleFrame but I reiterate that if it can only replicate what Styler can already do there is no point in its inclusion. I would like to kmow more about its additional features.

@datapythonista
Copy link
Member

Ah, thanks for the clarification @attack68, I didn't know our Styler supported exporting to Excel, my bad. I agree with you, we should say in the description why it can make sense to use StyleFrame instead of our styler then. @INDIG0N do you know whay StyleFrame supports that we don't? Or can you research about it?

@INDIG0N
Copy link
Contributor Author

INDIG0N commented Aug 10, 2022

Sorry it took me so long to get back to this @datapythonista

I've been having trouble finding anything styleframe can do that the pandas styler can't, so at this point I guess we should just close the pull request and the issue. Do you guys know how I can close this PR or is that something that has to be done your end?

@attack68
Copy link
Contributor

close as requested

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

Successfully merging this pull request may close these issues.

DOC: Mention "StyleFrame" package in "DataFrame.to_excel()"
4 participants