-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN refactor core dtypes #37584
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
CLN refactor core dtypes #37584
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7863781
refactor core dtypes
MarcoGorelli a67b324
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli 4e21831
revert check
MarcoGorelli 68479a1
revert
MarcoGorelli 9696dae
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli 8aaebe2
pass list of dtypeobj
MarcoGorelli d2b5bef
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli 5e53457
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli 1374cf8
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli 1d92e4f
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli a4bb6e8
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli 5241029
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli 9e1366d
coverage
MarcoGorelli b6ab2be
Merge branch 'refactor-core-dtypes' of github.com:MarcoGorelli/pandas…
MarcoGorelli f8ed13e
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli 65c5179
Merge remote-tracking branch 'upstream/master' into refactor-core-dtypes
MarcoGorelli f4a1ff1
Merge branch 'refactor-core-dtypes' of github.com:MarcoGorelli/pandas…
MarcoGorelli 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,8 +358,8 @@ def isna_compat(arr, fill_value=np.nan) -> bool: | |
------- | ||
True if we can fill using this fill_value | ||
""" | ||
dtype = arr.dtype | ||
if isna(fill_value): | ||
dtype = arr.dtype | ||
return not (is_bool_dtype(dtype) or is_integer_dtype(dtype)) | ||
return True | ||
|
||
|
@@ -447,9 +447,10 @@ def array_equivalent( | |
right = right.view("i8") | ||
|
||
# if we have structured dtypes, compare first | ||
if left.dtype.type is np.void or right.dtype.type is np.void: | ||
if left.dtype != right.dtype: | ||
return False | ||
if ( | ||
left.dtype.type is np.void or right.dtype.type is np.void | ||
) and left.dtype != right.dtype: | ||
return False | ||
|
||
return np.array_equal(left, right) | ||
|
||
|
@@ -484,11 +485,11 @@ def _array_equivalent_object(left, right, strict_nan): | |
if np.any(np.asarray(left_value != right_value)): | ||
return False | ||
except TypeError as err: | ||
if "Cannot compare tz-naive" in str(err): | ||
if "Cannot compare tz-naive" in str( | ||
err | ||
) or "boolean value of NA is ambiguous" in str(err): | ||
# tzawareness compat failure, see GH#28507 | ||
return False | ||
elif "boolean value of NA is ambiguous" in str(err): | ||
return False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think this is for coverage |
||
raise | ||
return True | ||
|
||
|
@@ -637,8 +638,6 @@ def isna_all(arr: ArrayLike) -> bool: | |
else: | ||
checker = lambda x: _isna_ndarraylike(x, inf_as_na=INF_AS_NA) | ||
|
||
for i in range(0, total_len, chunk_len): | ||
if not checker(arr[i : i + chunk_len]).all(): | ||
return False | ||
|
||
return True | ||
return all( | ||
checker(arr[i : i + chunk_len]).all() for i in range(0, total_len, chunk_len) | ||
) |
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.
where are we passing a Series? we shouldn't do this
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
pandas/tests/arrays/sparse/test_accessor.py::TestFrameAccessor::test_to_coo
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'll dig deeper at the weekend
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.
@jreback the problem is that when we do
then, in
to_coo
from pandas/core/arrays/sparse/accessor.py, we haveand so this is how we pass a Series (
self._parent.dtypes
is a Series).Is there a better way to fix this than
?