Skip to content
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

Customization of column analysis for categorical column #592

Closed
BALADEV-1234 opened this issue Oct 27, 2021 · 5 comments
Closed

Customization of column analysis for categorical column #592

BALADEV-1234 opened this issue Oct 27, 2021 · 5 comments

Comments

@BALADEV-1234
Copy link

BALADEV-1234 commented Oct 27, 2021

Hi Team,
Thank you very much for such a beautiful package. I want to highlight the rows, which start and end with spaces. currently I am only able to get the count of those rows through categorical column analysis. Is there any way to highlight those, please help me out. Thanks in advance.

@aschonfeld
Copy link
Collaborator

@BALADEV-1234 just trying to get some clarity. So you have some categorical data, strings I assume, and you want to filter down to the rows which have categories that start and end with spaces? If this is the case here's an example of how to do this.

I input this dataframe:

pd.DataFrame([
          {'desc': ' foo', 'count': 10, 'cum_pct': 15},
          {'desc': 'bar', 'count': 6, 'cum_pct': 40},
          {'desc': 'baz', 'count': 3, 'cum_pct': 75},
          {'desc': 'biz ', 'count': 1, 'cum_pct': 100}
      ])

And then you can go to the "Custom Filter" popup and input the following filter:

`desc`.str.startswith(' ') or `desc`.str.endswith(' ')

image

Hope this helps, let me know how it goes.

@lcorrigan
Copy link

@aschonfeld, Although filtering is useful, it is often visually helpful to be able to simply highlight some rows in an unfiltered grid. Excel conditional formatting is a pretty commonly used feature, but it's ruleset and UI for this are cumbersome. I think it would be awesome to be able to use a pandas query expression to apply a selectable highlight color to the resulting rows in the main table. I'm not not implying you re-create excel, but having something like this would save exporting it to analyze in a different tool. Ideally, the main grid would allow you to apply a highlight color of user choice for multiple (SHIFT+CLICK), possibly discontiguous rows (via CTRL+Click), but also have a form like this let you apply a user-chosen highlight color to the filtered rows like your form above. If the form was reused but instead offered a "Apply Highlight" button, it would make for a maybe a low-risk implementation?

@aschonfeld
Copy link
Collaborator

@lcorrigan I know you've wiped your hands of D-Tale but I'd still love your input on this new filter highlighting functionality I'm building. So right now theres two ways you can turn it on.

  1. toggling the highlighter icon on any active filter listed at the top of the screen
    https://user-images.githubusercontent.com/11547371/215193679-8c930a8d-6572-4954-aed1-30b7a5713936.mov

  2. Toggling the "Highlight Filtered Rows" checkbox on the filter popup or side panel:
    https://user-images.githubusercontent.com/11547371/215195044-12cfecde-4c14-4ebc-859a-ffc7f2d6ba15.mov

I'm also working on updating the code so that you can have filter highlighting turned on by default. By doing things like:

import pandas as pd
import dtale

dtale.show(pd.DataFrame([1,2,3,4,5]), highlight_filter=True)

or by specifying highlight_filter = True in the [show] section of thje global configuration file described here

Let me know what you think? Thanks

@lcorrigan
Copy link

Hi @aschonfeld, that looks pretty good to me, and covers the use-case in an easy-to-use way. Nice job.

@aschonfeld
Copy link
Collaborator

@BALADEV-1234 just released v2.12.0 with this functionality, let me know if you hit any issues

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

3 participants