Skip to content

CI: Fix npdev build #29860

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

Merged
merged 4 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
_np_version_under1p15,
_np_version_under1p16,
_np_version_under1p17,
_np_version_under1p18,
)

try:
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class TestPDApi(Base):
"_np_version_under1p15",
"_np_version_under1p16",
"_np_version_under1p17",
"_np_version_under1p18",
"_tslib",
"_typing",
"_version",
Expand Down
14 changes: 10 additions & 4 deletions pandas/tests/indexes/test_numpy_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
Float64Index,
Index,
Int64Index,
PeriodIndex,
TimedeltaIndex,
UInt64Index,
_np_version_under1p17,
_np_version_under1p18,
)
from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin
import pandas.util.testing as tm
Expand Down Expand Up @@ -80,18 +82,22 @@ def test_numpy_ufuncs_other(indices, func):
idx = indices
if isinstance(idx, (DatetimeIndex, TimedeltaIndex)):

# ok under numpy >= 1.17
if not _np_version_under1p17 and func in [np.isfinite]:
if not _np_version_under1p18 and func in [np.isfinite, np.isinf, np.isnan]:
# numpy 1.18(dev) changed isinf and isnan to not raise on dt64/tfd64
result = func(idx)
assert isinstance(result, np.ndarray)

elif not _np_version_under1p17 and func in [np.isfinite]:
# ok under numpy >= 1.17
# Results in bool array
result = func(idx)
assert isinstance(result, np.ndarray)
assert not isinstance(result, Index)
else:
# raise TypeError or ValueError (PeriodIndex)
with pytest.raises(Exception):
func(idx)

elif isinstance(idx, DatetimeIndexOpsMixin):
elif isinstance(idx, PeriodIndex):
# raise TypeError or ValueError (PeriodIndex)
with pytest.raises(Exception):
func(idx)
Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/reshape/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,13 +765,15 @@ def test_concat_join_axes_deprecated(self, axis):
)

expected = pd.concat([one, two], axis=1, sort=False).reindex(index=two.index)
result = pd.concat([one, two], axis=1, sort=False, join_axes=[two.index])
with tm.assert_produces_warning(FutureWarning):
Copy link
Contributor

Choose a reason for hiding this comment

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

Where are these warnings coming from?

Copy link
Member Author

Choose a reason for hiding this comment

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

join_axes is deprecated

Copy link
Contributor

Choose a reason for hiding this comment

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

And this failure wasn't caught earlier because the numpydev build is the only one that fails on warnings, and that was offline for a bit? If so, feel free to merge.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's my understanding, yes

Copy link
Member

Choose a reason for hiding this comment

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

join_axes is already deprecated for a few months, so there's probably another reason ..

result = pd.concat([one, two], axis=1, sort=False, join_axes=[two.index])
tm.assert_frame_equal(result, expected)

expected = pd.concat([one, two], axis=0, sort=False).reindex(
columns=two.columns
)
result = pd.concat([one, two], axis=0, sort=False, join_axes=[two.columns])
with tm.assert_produces_warning(FutureWarning):
result = pd.concat([one, two], axis=0, sort=False, join_axes=[two.columns])
tm.assert_frame_equal(result, expected)


Expand Down