-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: is_dtype_equal(dtype, "string[pyarrow]") raises if pyarrow not installed #44327
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
542032c
import error resolved
shubham11941140 76ab6fa
pre-commit
shubham11941140 c82d836
Update test_misc.py
shubham11941140 c35e162
Changes done
shubham11941140 cff657a
Duplicate test removed
shubham11941140 dce9db6
Changes done
shubham11941140 5abfa2e
raises modified
shubham11941140 fb0bd2a
changes done
shubham11941140 f7b8888
decorator fix
shubham11941140 2de4936
Changed tests
shubham11941140 66327e7
precommit
shubham11941140 9566360
StringDtype added
shubham11941140 0f35541
Try-Except Changed
shubham11941140 7ea6b15
Changes Done
shubham11941140 9b0dc6c
Merge branch 'master' into b5
shubham11941140 b0a75fc
remove np.dtype from isinstance check
jorisvandenbossche 75a4b26
remove np.dtype from isinstance check, catch ImportError instead
jorisvandenbossche f5bedc6
update whatsnew
jorisvandenbossche 9c68f5c
fix rst syntax in whatsnew
jorisvandenbossche c550a00
clean-up
jorisvandenbossche 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 hidden or 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 hidden or 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 hidden or 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.
To the above
dtypes
dict, can you add an entry for"string": pd.StringDtype()
?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 will be a mistake because isinstance(pd.StringDtype(), str) is False. Adding such an entry in taking to the wrong location in the code segment.
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.
Where is this being checked?
My question is to ensure that
is_dtype_equal(pd.StringDtype(), "string[pyarrow]")
correctly works, since that was the original bug report.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.
In this code
if not isinstance(source, str):
returns True when source ispd.StringDtype()
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 line returns True for all cases in the current test. Also the other
dtype
values in the parametrization of this test are actual dtype objects, not strings.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.
Agreed, but on adding this line into the parameters, this
if not isinstance(source, str):
returns True which is wrong. Shouldn'tisinstance(source, str)
be True if source ispd.StringDtype()
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.
No,
isinstance(source, str)
checks whethersource
is an actual python string object, whilepd.StringDtype
is a dtype object, which is a different class, and thus this is expected to return False (the fact that StringDtype is a dtype object for an array that stores strings doesn't matter in that case)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 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.
I added the testcase and fixed the Import Bug as well