Skip to content
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

Implement __array__ on ExtensionIndex #32255

Merged
merged 9 commits into from
Mar 7, 2020

Conversation

jbrockmendel
Copy link
Member

No description provided.



@pytest.mark.parametrize("array", [True, False])
def test_dunder_array(array):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have this test for indexes generally?

@jreback jreback added ExtensionArray Extending pandas with custom dtypes or arrays. Index Related to the Index class or subclasses labels Mar 3, 2020
@jreback jreback added this to the 1.1 milestone Mar 3, 2020
@jreback
Copy link
Contributor

jreback commented Mar 3, 2020

looks ok. @TomAugspurger if you'd have a look.

@jreback
Copy link
Contributor

jreback commented Mar 3, 2020

do we have an issue for adding __array_ufunc__ to index?

Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see an issue for Index.__array_ufunc__. Opened #32411 as a placeholder.

@@ -90,6 +90,8 @@ Backwards incompatible API changes
now raise a ``TypeError`` if a not-accepted keyword argument is passed into it.
Previously a ``UnsupportedFunctionCall`` was raised (``AssertionError`` if ``min_count`` passed into :meth:`~DataFrameGroupby.median``) (:issue:`31485`)
- :meth:`DataFrame.at` and :meth:`Series.at` will raise a ``TypeError`` instead of a ``ValueError`` if an incompatible key is passed, and ``KeyError`` if a missing key is passed, matching the behavior of ``.loc[]`` (:issue:`31722`)
- Passing an integer dtype other than ``int64`` to ``np.array(period_index, dtype=...)`` will now raise ``NotImplementedError`` instead of incorrectly using ``int64`` (:issue:`32255`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why NotImplementedError, rathan something like ValueError? Are we the ones raising it, or is NumPy?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though from the tests, it looks like a TypeError is raised (unless I'm misreading).

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. merge on @TomAugspurger comments

elif dtype == bool:
return ~self._isnan

# This will raise TypeErorr for non-object dtypes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo for follow-up

@simonjayhawkins simonjayhawkins merged commit edae9d1 into pandas-dev:master Mar 7, 2020
@simonjayhawkins
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the ei-array branch March 7, 2020 15:18
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays. Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants