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

Data Explorer: Visually display leading/trailing whitespace and empty strings in data values #5652

Merged
merged 4 commits into from
Dec 11, 2024

Conversation

wesm
Copy link
Contributor

@wesm wesm commented Dec 6, 2024

Addresses #3067. Currently in the data explorer, the strings "", " ", and " " cannot be visually distinguished because of the absence of quotations.

There are a few approaches we could take:

  1. Format with quotations (I believe RStudio does this)
  2. Provide a special display for empty strings (this is what's described as Data Explorer: Display empty string vs a whitespace  #3067)
  3. Replace whitespace with a unicode character to indicate the presence of leading/trailing whitespace characters

This PR does the latter two, using a mid-dot as the unicode representation and the special string <empty> for empty strings (will need to be localized).

@wesm wesm changed the title Data Explorer: Proposal for visually distinguishing whitespace and empty strings Data Explorer: Proposal for visually distinguishing whitespace and empty strings in data values Dec 6, 2024
@wesm
Copy link
Contributor Author

wesm commented Dec 6, 2024

Some ideas:

  • Use a different unicode character than the one selected here
  • Only insert "whitespace characters" for leading or trailing whitespace (some of the smoke tests are failing because of this)
  • Render these whitespace characters with < 100% opacity (like the special values)

@wesm wesm force-pushed the feature/de-empty-strings-whitespace branch from fc6b675 to 9556686 Compare December 9, 2024 19:03
@wesm
Copy link
Contributor Author

wesm commented Dec 9, 2024

Here's another try:

image

  • Use middle dot as the whitespace character
  • Only replace leading and trailing whitespaces
  • Set opacity < 100%

code for creating data is:

df = pd.DataFrame({'a': ["", "", " ", "  wat", "   wh  at  "]})

A part of me thinks that using quotations might be better, but this seems reasonable as well

@wesm wesm force-pushed the feature/de-empty-strings-whitespace branch from 9556686 to 19d935b Compare December 11, 2024 22:06
@wesm
Copy link
Contributor Author

wesm commented Dec 11, 2024

I added a localization hook for the <empty> string representation. Will merge this once the build is green since this seems like a reasonable improvement over the status quo, and we can iterate on it based on user feedback

@wesm wesm changed the title Data Explorer: Proposal for visually distinguishing whitespace and empty strings in data values Data Explorer: Visually display leading/trailing whitespace and empty strings in data values Dec 11, 2024
@wesm wesm merged commit bb6af97 into main Dec 11, 2024
5 checks passed
@wesm wesm deleted the feature/de-empty-strings-whitespace branch December 11, 2024 22:56
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant