-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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 construction with given dtype (sort of shallow_copy?) #20747
Comments
Agreed. This is somewhat similar to No thoughts on a solution yet, but a good test may be to parametrize |
The tests that I mentioned in the original post are still skipped, so we need to check if this can now be resolved with the added |
* ENH: add integer-na support via an ExtensionArray closes pandas-dev#20700 closes pandas-dev#20747
Many of the extension arrays tests are skipped for
Categorical
because the reconstruction of the expected result does not preserve the categoricals (so kind of the "metadata" of the dtype).For example:
pandas/pandas/tests/extension/category/test_categorical.py
Lines 70 to 72 in 78fee04
because in the actual test, the expected result is constructed from a list:
pandas/pandas/tests/extension/base/reshaping.py
Lines 47 to 50 in 78fee04
(still with
type(data)(..)
, but replacing that withdata._constructor_from_sequence(..)
in #20746).This is kind of a recurrent pattern, so that might indicate we should find a solution for this?
So do we want a canonical way in the extension array interface to construct an ExtensionArray that has a certain dtype?
Possible solution is to add a
dtype
keyword to_constructor_from_sequence
The text was updated successfully, but these errors were encountered: