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.
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
[ArrayManager] REF: Implement concat with reindexing #39612
[ArrayManager] REF: Implement concat with reindexing #39612
Changes from 28 commits
6cd1c4d
73d9de2
272d674
555d7ac
ebad8a4
ee495e5
19c7f75
42e1b05
724be3e
db3f0ed
a2aa388
6bdd175
910e1fe
cab90f6
c22a010
eec0161
6c69869
04ead63
427b6f4
8c10a53
ec5bd11
f0061f7
9ba8854
ad61f2f
d960619
a3c2662
0fafb1a
f67e9e2
f655e33
d21bd3a
9435c39
22ea7d2
77b05f4
81d0954
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
yah this probably belongs in dtypes.cast (independent of this PR)
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.
do we need ArrayLike to include NullArrayProxy?
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.
can you now remove concat_compat?
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.
and reading your comment below, why is this not in array manger if its only used there?
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.
concat_compat
is used in several other places as wellBecause this is the code for concatting managers, which for BlockManager also resides in internals/concat.py?
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.
the annotation is List[Any]. can that be made more specific?
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 principle the more specific annotation would be
List[Union[np.ndarray, ExtensionArray, NullArrayProxy]]
. But, iwhen adding that, that gives a bunch of errors down the line because mypy cannot figure out that we are eg converting all input to EAs before passing to_concat_same_type
.So unless if you have specific suggestions how to solve this, I'd rather leave it less specified (for example
concat_compat
is also not typed).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 think the practice in this case is to not annotate rather than use Any, cc @simonjayhawkins
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.
But
List[Any]
at least indicates it needs to receive a list, which can be better than no typing at all?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.
im hoping @simonjayhawkins will weigh in here, but my understanding of the rule of thumb is that
List[Any]
denotes "this cannot be further narrowed down" whereasList
denotes "its a list and the annotation is incomplete; contributions welcome"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.
Ah, I thought you meant to have no annoation at all (like
concat_compat
). I can certainly make itList
instead ofList[Any]
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 think that's the general consensus at the moment until we add
disallow_any_generics
#30539 which will force us to add type parameters.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.
can the new JoinUnit.is_valid_na_for be used for these?
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.
Something similar could be used, but for now I didn't include such logic on purpose (I would like to keep the
concat
implementation for ArrayManager to strictly follow the dtype casting rules without any values-dependent behaviour for now in this initial implementation. We can later see if there are cases that might need to be added back for usability)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 think weve landed on the idea being to keep the behaviors matching wherever feasible
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 general where it is easy to do so, yes. But for now I kept the new implementation strictly dtype-dependent without any value-dependent behaviour. I don't think we need to mimic every special case or inconsistency of the BM in the new code, but of course in this case it depends on what behaviour we want long term. I opened #40893 for this.