Skip to content

ENH: View a data frame as a table with colored backgrounds #6009

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
8one6 opened this issue Jan 20, 2014 · 1 comment
Closed

ENH: View a data frame as a table with colored backgrounds #6009

8one6 opened this issue Jan 20, 2014 · 1 comment

Comments

@8one6
Copy link

8one6 commented Jan 20, 2014

In Excel, it's very common to add conditional formatting to a range of data (either a single column, or a 2-d table). In newer versions of Excel, there are handy buttons to apply a full gradient as a background color to a range of data to highlight high and low values.

I wonder if we can easily provide a similar kind of functionality for Pandas. Two general strategies immediately came to mind for me, and I'm sure there will be other suggestions, too. But just to get the ball rolling:

  1. We could provide a DataFrame method (maybe one for Series, too) that produces a Matplotlib heatmap with overlaid values as text. See:
    http://stackoverflow.com/a/11918066/2501018
    http://stackoverflow.com/a/21167108/2501018

  2. (I really have no idea if this is possible, but just to throw it out there...) We could augment the HTML representation of a DataFrame to include the ability to use background colors for certain cells of the table.

It seems like either way there would be some general questions to answer/functionalities to provide:
-Color all cells, or just certain columns/rows?
-Color based on value or based on an arbitrary function of value (for example abs)
-Color cells in relation to their own column/row or in relation to all values in the table

What do you guys think? Is this a general enough problem to merit a solution within Pandas? Or is this perhaps something better suited to Matplotlib? Or should I just write functions that accept DataFrame input and create Matplotlib output in line with the SO posts above?

@ghost
Copy link

ghost commented Jan 20, 2014

#5763
The examples include a basic heatmap, topk and a little bit more.

slated for 0.14, though still undetermined whether as part of pandas or
an optional dependency. The API there is still provisional.

see #3190 for more eycandy from an earlier attempt,
all should be possible with new version, though differently coded.

@ghost ghost closed this as completed Jan 20, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant