Skip to content

DOC: repurpose Styler as a general display tool and not an HTML-CSS tool #47830

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

Open
1 task done
attack68 opened this issue Jul 23, 2022 · 5 comments
Open
1 task done
Labels
Docs Styler conditional formatting using DataFrame.style

Comments

@attack68
Copy link
Contributor

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/pandas-docs/dev/user_guide/style.html

Documentation problem

When Styler was originally designed and released, its aim was to display HTML in a Jupyter Notebook, that could be manipulated and conditionally formatted. The user guide and documentation over the years has therefore focused on the HTML side of things, and the more recent display and general formatting features are seen as extras to suit that environment, and patchwork included in the documentation.

This issue probably targets pandas 2.0 where I am suggesting that the Table Visualization part of the user guide pushes Styler as a generalist DataFrame formatter, describing the generic functionality it has, and also expanding the conditional aspects which can now be output to HTML, LaTeX and Excel.

My philosophy with the development I put into Styler was for it to be;

  • First and foremost a formatting tool to display data in any way the user wants, without changing the underlying data, with outputs to String (i.e. CSV), HTML, LaTeX, Excel, and (ultimately) JSON.
  • Provide extra conditional formatting features that suit the environment, e.g. HTML-CSS, LaTeX commands, Excel colors, etc.

Any comments welcome, but I think moving forward having a variety of easily accessible, configurable display representations is a great tool for data science.

Comments very welcome.

Suggested fix for documentation

.

@attack68 attack68 added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 23, 2022
@datapythonista
Copy link
Member

Makes sense to me. I'd also consider moving the styler to a separate project. Moving to another repo should be trivial, and I think it'd allow the new project to evolve faster, not being constrained by pandas development. And also, it'd open the door to have other competing or related projects, making this part of pandas an extension.

@mroeschke mroeschke added Styler conditional formatting using DataFrame.style and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 25, 2022
@mroeschke
Copy link
Member

+1 for generalizing and spinning off into a dedicated pandas extension (within the pandas-dev Github project).

@attack68
Copy link
Contributor Author

Yes this might make sense, possible as part of pandas 2.0. I'm afraid I have little experience in the separating package, new repo management side of things, as regards to setting up tests, and workflows etc, so would need dedicated resources as per the pandas dev team here to do all this - might make this a non-starter? Not a lot of people actively involved in Styler.

@datapythonista
Copy link
Member

Once there is agreement, I'm happy to help with this. I think it should be quite quick. In Ibis I moved several parts to third-party repos, and the only tricky part is defining the API among the components. Which I think in this case it's trivial, as I guess the styler is mostly using the pandas public API, and pandas itself doesn't know anything about the styler.

@tehunter
Copy link
Contributor

tehunter commented Oct 4, 2022

My two cents as a Styler.to_excel "power user", I like the idea of separating the Styler into a separate package within the pandas environment. I currently have an internal package to export DataFrames to Excel using Styler as a backend, following an extensive set of formatting rules for a consistent design in line with our style guide regardless of DataFrame. I see one benefit of separating the Styler package to be allowing the possible growth a more vibrant Theming and Plugins community.

Also, I've had to do some overriding of Styler class functions to get certain behavior I need. Some of these bug fixes and enhancements I've submitted as pull requests, but since they're subject to Pandas' release tempo, I've had to maintain a duplicate set of overrides to access these features in between Pandas releases. Having a separate package would allow the features of Styler to advance at its own pace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Styler conditional formatting using DataFrame.style
Projects
None yet
Development

No branches or pull requests

4 participants