You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
(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?
The text was updated successfully, but these errors were encountered:
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:
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
(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?
The text was updated successfully, but these errors were encountered: