-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ExtensionArray: deprecation of _formatting_values not working? #24858
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
Comments
OK, so it might be due to the incomplete implementation. Because if I add a The special case here is that I have objects that have a length, so if you want to convert them to a numpy array, It is probably obvious that And maybe we should be explicit in |
Would rewriting the formatting code to handle either ndarrays or ExtensionArrays would be the best path forward for users, right? Then we wouldn't have an intermediate conversion to ndarray? |
Normally it still first slices the part of the full EA that is needed for the display, so a possibly costly conversion of the full EA to a ndarray is avoided in that case. So given that, I am not sure it is that important to avoid this conversion to ndarray? |
Agreed. So pass |
I don't see |
I am doing a small demo ExtensionArray, and it seems the repr is not working properly without defining
_formatting_values
.Reproducible example (it's not a complete implementation, but I think the error here is not caused by that);
gives "TypeError: float() argument must be a string or a number, not 'Point'".
full error message
So it seems that it still tries to convert the values to an array, as the default of
_formatting_values
does (return np.array(self)
), instead of calling the_formatter
on the individual elements.If I add a
_formatting_values
that returns an object array, it works correctly.cc @TomAugspurger
The text was updated successfully, but these errors were encountered: