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 strips leading or trailing whitespace from column names. #3089

Closed
jthomasmock opened this issue May 9, 2024 · 3 comments
Closed
Labels
area: data explorer Issues related to Data Explorer category. bug Something isn't working frontend Issues having to do with the frontend (Electron) part of a category

Comments

@jthomasmock
Copy link
Contributor

Positron Dev Version: 2024.05.0 build 0
Code - OSS Version: 1.89.0
Commit: Unknown
Date: Unknown
Electron: 28.2.8
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.4.0

Steps to reproduce the issue:

  1. Create a dataframe with whitespace in front of the actual name
example <- data.frame(1:10, 1:10, 1:10)

names(example) <- c("age1", "               age2", "age3")
import pandas as pd

lead_ws = pd.DataFrame({"          leading_whitespace": [1,2,3], 
                       "trailing whitespace               ": [1,2,3]})
%view lead_ws
  1. Open it in the Data Explorer

image

image

  1. Note that all the leading and trailing whitespace has been stripped.

What did you expect to happen?

We should honor the exact name of the column.

Were there any error messages in the output or Developer Tools console?

@jthomasmock jthomasmock added bug Something isn't working area: data explorer Issues related to Data Explorer category. frontend Issues having to do with the frontend (Electron) part of a category labels May 9, 2024
@petetronic petetronic added this to the Release Candidate milestone May 13, 2024
wesm added a commit that referenced this issue Jan 3, 2025
…g whitespace or empty string (#5653)

Aims to address #3084, #3089. Related to #5652, we also cannot
distinguish empty strings or strings with leading whitespace in column
names both in the data grid headers and the summary panel.

This PR applies the same approach we used for data cells to format
column names in the grid headers and the summary pane.
@jonvanausdeln
Copy link
Contributor

I notice that this strips excessive whitespace inside of a column name.

import pandas as pd

lead_ws = pd.DataFrame({"          leading_whitespace": [1,2,3], 
                       "trailing whitespace               ": [1,2,3],
                       "middle                 whitespace": [1,2,3]})

Would you like a new issue on this?

@wesm
Copy link
Contributor

wesm commented Jan 6, 2025

Yes, please open a new issue for that. I don't believe that the change I made affects formatting of whitespace in the middle, so if we want to fix that we'll have to do some more work (e.g. using middle dots for anything more than a single space).

@jonvanausdeln
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2025.01.0-152
OS Version(s) : Windows 11

Test scenario(s)

Leading and trailing spaces are preserved as expected.

Link(s) to TestRail test cases run or created:

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: data explorer Issues related to Data Explorer category. bug Something isn't working frontend Issues having to do with the frontend (Electron) part of a category
Projects
None yet
Development

No branches or pull requests

4 participants