-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: remove single quotes in index names when printing #60251
Merged
rhshadrach
merged 23 commits into
pandas-dev:main
from
thedataninja1786:bugfix--pprint-embedded-quotes
Nov 29, 2024
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
42203a9
remove single quotes in index names when printing
thedataninja1786 5d9edbf
Removed trailing whitespace
thedataninja1786 5da2343
Removed trailing whitespaces
thedataninja1786 9519268
Merge branch 'main' into bugfix--pprint-embedded-quotes
thedataninja1786 a13b8b1
branch 'upstream/main' into bugfix--pprint-embedded-quotes
thedataninja1786 f0a9008
Added relevant tests when removing single quotes
thedataninja1786 0f1c9e5
Merge branch 'bugfix--pprint-embedded-quotes' of https://github.com/t…
thedataninja1786 9552a43
Refactor test_formatted_index_names to adhere with line-legth constra…
thedataninja1786 597e6c5
Merge remote-tracking branch 'upstream/main' into bugfix--pprint-embe…
thedataninja1786 2fa7eeb
Escape single quotes
thedataninja1786 034ad05
Merge branch 'main' into bugfix--pprint-embedded-quotes
thedataninja1786 c3aa8f0
Merge remote-tracking branch 'upstream/main' into bugfix--pprint-embe…
thedataninja1786 bdcbca1
Apply formatting and import sorting from pre-commit hooks
thedataninja1786 a6cad8d
Apply formatting and import sorting from pre-commit hooks
thedataninja1786 9d02418
Apply formatting and import sorting from pre-commit hooks
thedataninja1786 7e59bda
Merge branch 'bugfix--pprint-embedded-quotes' of https://github.com/t…
thedataninja1786 67fd773
Apply formatting and import sorting from pre-commit hooks
thedataninja1786 67ecd35
Merge remote-tracking branch 'upstream/main' into bugfix--pprint-embe…
thedataninja1786 8c41d9d
Update whatsnew
thedataninja1786 7a4c1ee
Merge remote-tracking branch 'upstream/main' into bugfix--pprint-embe…
thedataninja1786 2c3625a
Update whatsnew in v3.0.0.
thedataninja1786 6391b76
Update whatsnew in v3.0.0.
thedataninja1786 10df8b4
Converted tests for string comparisons
thedataninja1786 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test passes on the main branch, so is not testing your changes. You can do
str(df.index.names)
and compare this to the expected value, e.g.['\'a', 'b']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue that I didn't realize before, that's why the tests pass. When the tests look like this
running the pre-commit checks:
pre-commit run --from-ref=upstream/main --to-ref=HEAD --all-files
fail, and convert it to the format of the latest PR (i.e. not escaping the single quotes).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When comparing to
str(df.index.names)
, you want the expected to be a single string, not a list of strings. But indeed, you need to escape the backslash:['\\'a', 'b']
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify my previous comment, you cannot compare single entries because with a backslash (this PR) and without a backslash (main) evaluate as equal. However if you convert the entire
index.names
to a string, they do not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I think I'm with you :)