Skip to content

CI: Numpy changed dtype inference #39089

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

Closed
phofl opened this issue Jan 10, 2021 · 8 comments · Fixed by #39225
Closed

CI: Numpy changed dtype inference #39089

phofl opened this issue Jan 10, 2021 · 8 comments · Fixed by #39225
Labels
Bug CI Continuous Integration Dtype Conversions Unexpected or buggy dtype conversions Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@phofl
Copy link
Member

phofl commented Jan 10, 2021

Numpy changed the dtype inference (numpy/numpy#17863), which causes tests to fail. Problem description as follows:

other = [pd.Interval(0, 1, closed="right"), 0, "foo"]
arr = np.asarray(other)
result = pd.array(arr)

On a regular Numpy version the numpy array has dtype object and this returns

<PandasArray>
[Interval(0, 1, closed='right'), 0, 'foo']
Length: 3, dtype: object

while on numpy dev the numpy array has dtype <U64 and this returns

<StringArray>
['(0, 1]', '0', 'foo']
Length: 3, dtype: string

This leads to a different evaluation of is_object_dtype(other_dtype)

@phofl phofl added Bug Needs Triage Issue that has not been reviewed by a pandas team member CI Continuous Integration labels Jan 10, 2021
@phofl phofl added the Dtype Conversions Unexpected or buggy dtype conversions label Jan 10, 2021
@jbrockmendel
Copy link
Member

is it just me or does this look like really weird behavior on numpy's part?

@jreback
Copy link
Contributor

jreback commented Jan 10, 2021

yea this should be reverted by numpy it is a huge breaking change

@phofl
Copy link
Member Author

phofl commented Jan 10, 2021

Seems like a bug.

arr1 = np.asarray([0, "foo", pd.Interval(0, 1, closed="right")])
print(arr1.dtype)
arr = np.asarray([pd.Interval(0, 1, closed="right"), 0, "foo"])
print(arr.dtype)

returns

object
<U64

@jbrockmendel
Copy link
Member

cc @seberg

@seberg
Copy link
Contributor

seberg commented Jan 10, 2021

Thanks, the problematic PR is numpy/numpy#18115, I managed to write && instead of || (at least I guess). The more annoying thing is that the NumPy tests apparently only test the first case of your examples @jbrockmendel ...

@jreback
Copy link
Contributor

jreback commented Jan 10, 2021

thanks @seberg

@jreback
Copy link
Contributor

jreback commented Jan 16, 2021

@seberg so this is fixed in numpy master?

@seberg
Copy link
Contributor

seberg commented Jan 16, 2021

Yes, was a simple bug and should be fixed (and I guess by now the new, corrected, weekly build is up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CI Continuous Integration Dtype Conversions Unexpected or buggy dtype conversions Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants