Skip to content

TST: Added test for bug Reindexing pd.Float64Dtype() series gives runtime warnings when passed to np.log #47087

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 8 commits into from
Jun 8, 2022
10 changes: 10 additions & 0 deletions pandas/tests/series/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import pytest

from pandas import (
NA,
DataFrame,
Float64Dtype,
IndexSlice,
MultiIndex,
Series,
Expand Down Expand Up @@ -330,6 +332,14 @@ def test_loc_setitem_all_false_indexer():
tm.assert_series_equal(ser, expected)


def test_reindexing_values():
# GH 47055
s = Series([1.0, NA], dtype=Float64Dtype())
s_reindex = s.reindex(range(3))
Copy link
Member

Choose a reason for hiding this comment

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

  1. Could you move this test to pandas/tests/series/methods/test_reindex.py?
  2. Could you mention in the test name that it involves Float64 with NA?
  3. Could you also test that a warning isnt raised like
tm.assert_produces_warning(None):
    result = np.log(s_reindex)
    expected = ...

expected = np.array([1, np.NaN, np.NaN])
tm.assert_numpy_array_equal(s_reindex.values._data, expected)


class TestDeprecatedIndexers:
@pytest.mark.parametrize("key", [{1}, {1: 1}])
def test_getitem_dict_and_set_deprecated(self, key):
Expand Down