-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
ExtensionArray constructor issue #19906
Comments
what is the reason for this? |
In case a subclass has a different |
+1 I only would make them private Also we could here make clear expectations about data being copied or not (and for that, maybe add a |
Yes, I thought about making that part of the |
I think the fact we cannot rely upon is if it always can be done without copy, but we can rely on requiring a copy? (similar to the |
Yes, that sounds right. Also +1 to making them private Are there any other cases we should consider? In cyberpandas I have two others
|
and we already have and use |
This is as much (or more so) for external code as it is for pandas. We can't impose the same restrictions on 3rd party libraries as we do internally. The use of these constructors will be limited. The only place returning |
We are adding functionality here. There is no place in pandas where we currently call this for ExtensionArrays, so each call we add we can evaluate to see which one we should use. For example, |
Indeed, eg the |
I agree with this change. |
Adds two new (private, but part of the interface) constructors to EA. Closes pandas-dev#19906
Do we actually currently have cases where we would use |
Good point. I initially included it because that's a case I ran into with cyberpandas' |
I don't think that pandas should make any assumptions on how subclasses
__init__
method. Currently we assume that the first positional argument accepts an instance of the class or a sequence of the class's scalar type.I'd rather break that into two distinct methods.
I think these should be abstract. For many subclasses, a simple
cls(arg)
should suffice.The text was updated successfully, but these errors were encountered: