From 5cced786b0460f558f50f970cdeb06fdb93a742a Mon Sep 17 00:00:00 2001 From: Terji Petersen Date: Mon, 30 Jan 2023 19:59:58 +0000 Subject: [PATCH 1/3] DEPR: Remove NumericIndex name in repr output --- pandas/core/arrays/timedeltas.py | 3 +- pandas/core/indexes/base.py | 48 ++++++++++--------- pandas/core/indexes/multi.py | 2 +- pandas/core/strings/accessor.py | 2 +- pandas/io/formats/info.py | 4 +- pandas/tests/indexes/test_any_index.py | 2 + pandas/tests/indexing/test_loc.py | 15 +++--- pandas/tests/indexing/test_partial.py | 4 +- pandas/tests/resample/test_resample_api.py | 2 +- .../util/test_assert_categorical_equal.py | 8 ++-- pandas/tests/util/test_assert_index_equal.py | 34 ++++++------- 11 files changed, 63 insertions(+), 61 deletions(-) diff --git a/pandas/core/arrays/timedeltas.py b/pandas/core/arrays/timedeltas.py index 1e7d5f0436e7e..861c9712cd2ae 100644 --- a/pandas/core/arrays/timedeltas.py +++ b/pandas/core/arrays/timedeltas.py @@ -769,8 +769,7 @@ def total_seconds(self) -> npt.NDArray[np.float64]: dtype='timedelta64[ns]', freq=None) >>> idx.total_seconds() - NumericIndex([0.0, 86400.0, 172800.0, 259200.0, 345600.0], - dtype='float64') + Index([0.0, 86400.0, 172800.0, 259200.0, 345600.0], dtype='float64') """ pps = periods_per_second(self._creso) return self._maybe_mask_results(self.asi8 / pps, fill_value=None) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index be84e292b63e7..635cf939cbb5f 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -320,7 +320,7 @@ class Index(IndexOpsMixin, PandasObject): Examples -------- >>> pd.Index([1, 2, 3]) - NumericIndex([1, 2, 3], dtype='int64') + Index([1, 2, 3], dtype='int64') >>> pd.Index(list('abc')) Index(['a', 'b', 'c'], dtype='object') @@ -1194,6 +1194,10 @@ def __repr__(self) -> str_t: Return a string representation for this object. """ klass_name = type(self).__name__ + from pandas.core.indexes.numeric import NumericIndex + + if type(self) is NumericIndex: + klass_name = "Index" data = self._format_data() attrs = self._format_attrs() space = self._format_space() @@ -1716,9 +1720,9 @@ def set_names( -------- >>> idx = pd.Index([1, 2, 3, 4]) >>> idx - NumericIndex([1, 2, 3, 4], dtype='int64') + Index([1, 2, 3, 4], dtype='int64') >>> idx.set_names('quarter') - NumericIndex([1, 2, 3, 4], dtype='int64', name='quarter') + Index([1, 2, 3, 4], dtype='int64', name='quarter') >>> idx = pd.MultiIndex.from_product([['python', 'cobra'], ... [2018, 2019]]) @@ -2004,7 +2008,7 @@ def droplevel(self, level: IndexLabel = 0): names=['x', 'y']) >>> mi.droplevel(['x', 'y']) - NumericIndex([5, 6], dtype='int64', name='z') + Index([5, 6], dtype='int64', name='z') """ if not isinstance(level, (tuple, list)): level = [level] @@ -2713,7 +2717,7 @@ def isna(self) -> npt.NDArray[np.bool_]: >>> idx = pd.Index([5.2, 6.0, np.NaN]) >>> idx - NumericIndex([5.2, 6.0, nan], dtype='float64') + Index([5.2, 6.0, nan], dtype='float64') >>> idx.isna() array([False, False, True]) @@ -2770,7 +2774,7 @@ def notna(self) -> npt.NDArray[np.bool_]: >>> idx = pd.Index([5.2, 6.0, np.NaN]) >>> idx - NumericIndex([5.2, 6.0, nan], dtype='float64') + Index([5.2, 6.0, nan], dtype='float64') >>> idx.notna() array([ True, True, False]) @@ -3081,7 +3085,7 @@ def union(self, other, sort=None): >>> idx1 = pd.Index([1, 2, 3, 4]) >>> idx2 = pd.Index([3, 4, 5, 6]) >>> idx1.union(idx2) - NumericIndex([1, 2, 3, 4, 5, 6], dtype='int64') + Index([1, 2, 3, 4, 5, 6], dtype='int64') Union mismatched dtypes @@ -3273,7 +3277,7 @@ def intersection(self, other, sort: bool = False): >>> idx1 = pd.Index([1, 2, 3, 4]) >>> idx2 = pd.Index([3, 4, 5, 6]) >>> idx1.intersection(idx2) - NumericIndex([3, 4], dtype='int64') + Index([3, 4], dtype='int64') """ self._validate_sort_keyword(sort) self._assert_can_do_setop(other) @@ -3420,9 +3424,9 @@ def difference(self, other, sort=None): >>> idx1 = pd.Index([2, 1, 3, 4]) >>> idx2 = pd.Index([3, 4, 5, 6]) >>> idx1.difference(idx2) - NumericIndex([1, 2], dtype='int64') + Index([1, 2], dtype='int64') >>> idx1.difference(idx2, sort=False) - NumericIndex([2, 1], dtype='int64') + Index([2, 1], dtype='int64') """ self._validate_sort_keyword(sort) self._assert_can_do_setop(other) @@ -3503,7 +3507,7 @@ def symmetric_difference(self, other, result_name=None, sort=None): >>> idx1 = pd.Index([1, 2, 3, 4]) >>> idx2 = pd.Index([2, 3, 4, 5]) >>> idx1.symmetric_difference(idx2) - NumericIndex([1, 5], dtype='int64') + Index([1, 5], dtype='int64') """ self._validate_sort_keyword(sort) self._assert_can_do_setop(other) @@ -5068,7 +5072,7 @@ def __contains__(self, key: Any) -> bool: -------- >>> idx = pd.Index([1, 2, 3, 4]) >>> idx - NumericIndex([1, 2, 3, 4], dtype='int64') + Index([1, 2, 3, 4], dtype='int64') >>> 2 in idx True @@ -5266,7 +5270,7 @@ def equals(self, other: Any) -> bool: -------- >>> idx1 = pd.Index([1, 2, 3]) >>> idx1 - NumericIndex([1, 2, 3], dtype='int64') + Index([1, 2, 3], dtype='int64') >>> idx1.equals(pd.Index([1, 2, 3])) True @@ -5283,10 +5287,10 @@ def equals(self, other: Any) -> bool: >>> ascending_idx = pd.Index([1, 2, 3]) >>> ascending_idx - NumericIndex([1, 2, 3], dtype='int64') + Index([1, 2, 3], dtype='int64') >>> descending_idx = pd.Index([3, 2, 1]) >>> descending_idx - NumericIndex([3, 2, 1], dtype='int64') + Index([3, 2, 1], dtype='int64') >>> ascending_idx.equals(descending_idx) False @@ -5294,10 +5298,10 @@ def equals(self, other: Any) -> bool: >>> int64_idx = pd.Index([1, 2, 3], dtype='int64') >>> int64_idx - NumericIndex([1, 2, 3], dtype='int64') + Index([1, 2, 3], dtype='int64') >>> uint64_idx = pd.Index([1, 2, 3], dtype='uint64') >>> uint64_idx - NumericIndex([1, 2, 3], dtype='uint64') + Index([1, 2, 3], dtype='uint64') >>> int64_idx.equals(uint64_idx) True """ @@ -5520,18 +5524,18 @@ def sort_values( -------- >>> idx = pd.Index([10, 100, 1, 1000]) >>> idx - NumericIndex([10, 100, 1, 1000], dtype='int64') + Index([10, 100, 1, 1000], dtype='int64') Sort values in ascending order (default behavior). >>> idx.sort_values() - NumericIndex([1, 10, 100, 1000], dtype='int64') + Index([1, 10, 100, 1000], dtype='int64') Sort values in descending order, and also get the indices `idx` was sorted by. >>> idx.sort_values(ascending=False, return_indexer=True) - (NumericIndex([1000, 100, 10, 1], dtype='int64'), array([3, 1, 0, 2])) + (Index([1000, 100, 10, 1], dtype='int64'), array([3, 1, 0, 2])) """ idx = ensure_key_mapped(self, key) @@ -6178,7 +6182,7 @@ def isin(self, values, level=None) -> npt.NDArray[np.bool_]: -------- >>> idx = pd.Index([1,2,3]) >>> idx - NumericIndex([1, 2, 3], dtype='int64') + Index([1, 2, 3], dtype='int64') Check whether each index value in a list of values. @@ -6975,7 +6979,7 @@ def ensure_index_from_sequences(sequences, names=None) -> Index: Examples -------- >>> ensure_index_from_sequences([[1, 2, 3]], names=["name"]) - NumericIndex([1, 2, 3], dtype='int64', name='name') + Index([1, 2, 3], dtype='int64', name='name') >>> ensure_index_from_sequences([["a", "a"], ["a", "b"]], names=["L1", "L2"]) MultiIndex([('a', 'a'), diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 14240f1d19472..19c17fd0a4358 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -1642,7 +1642,7 @@ def get_level_values(self, level): level_1 int64 dtype: object >>> pd.MultiIndex.from_arrays([[1, None, 2], [3, 4, 5]]).get_level_values(0) - NumericIndex([1.0, nan, 2.0], dtype='float64') + Index([1.0, nan, 2.0], dtype='float64') """ level = self._get_level_number(level) values = self._get_level_values(level) diff --git a/pandas/core/strings/accessor.py b/pandas/core/strings/accessor.py index a232d1dd77da5..803dbe32bc16b 100644 --- a/pandas/core/strings/accessor.py +++ b/pandas/core/strings/accessor.py @@ -2247,7 +2247,7 @@ def count(self, pat, flags: int = 0): This is also available on Index >>> pd.Index(['A', 'A', 'Aaba', 'cat']).str.count('a') - NumericIndex([0, 0, 2, 1], dtype='int64') + Index([0, 0, 2, 1], dtype='int64') """ result = self._data.array._str_count(pat, flags) return self._wrap_result(result, returns_string=False) diff --git a/pandas/io/formats/info.py b/pandas/io/formats/info.py index 9a93724ca8f37..d826c0a148ebe 100644 --- a/pandas/io/formats/info.py +++ b/pandas/io/formats/info.py @@ -165,7 +165,7 @@ >>> s = pd.Series(text_values, index=int_values) >>> s.info() - NumericIndex: 5 entries, 1 to 5 + Index: 5 entries, 1 to 5 Series name: None Non-Null Count Dtype -------------- ----- @@ -177,7 +177,7 @@ >>> s.info(verbose=False) - NumericIndex: 5 entries, 1 to 5 + Index: 5 entries, 1 to 5 dtypes: object(1) memory usage: 80.0+ bytes diff --git a/pandas/tests/indexes/test_any_index.py b/pandas/tests/indexes/test_any_index.py index 3b3d6dbaf697f..fdea2945a8c0b 100644 --- a/pandas/tests/indexes/test_any_index.py +++ b/pandas/tests/indexes/test_any_index.py @@ -154,6 +154,8 @@ def test_str(self, index): # test the string repr index.name = "foo" assert "'foo'" in str(index) + if type(index).__name__ == "NumericIndex": # TODO: remove NumericIndex + return assert type(index).__name__ in str(index) diff --git a/pandas/tests/indexing/test_loc.py b/pandas/tests/indexing/test_loc.py index 5445053027940..34ecc75769d0b 100644 --- a/pandas/tests/indexing/test_loc.py +++ b/pandas/tests/indexing/test_loc.py @@ -439,7 +439,7 @@ def test_loc_to_fail(self): ) msg = ( - rf"\"None of \[NumericIndex\(\[1, 2\], dtype='{np.int_().dtype}'\)\] are " + rf"\"None of \[Index\(\[1, 2\], dtype='{np.int_().dtype}'\)\] are " r"in the \[index\]\"" ) with pytest.raises(KeyError, match=msg): @@ -457,7 +457,7 @@ def test_loc_to_fail2(self): s.loc[-1] msg = ( - rf"\"None of \[NumericIndex\(\[-1, -2\], dtype='{np.int_().dtype}'\)\] are " + rf"\"None of \[Index\(\[-1, -2\], dtype='{np.int_().dtype}'\)\] are " r"in the \[index\]\"" ) with pytest.raises(KeyError, match=msg): @@ -473,7 +473,7 @@ def test_loc_to_fail2(self): s["a"] = 2 msg = ( - rf"\"None of \[NumericIndex\(\[-2\], dtype='{np.int_().dtype}'\)\] are " + rf"\"None of \[Index\(\[-2\], dtype='{np.int_().dtype}'\)\] are " r"in the \[index\]\"" ) with pytest.raises(KeyError, match=msg): @@ -490,7 +490,7 @@ def test_loc_to_fail3(self): df = DataFrame([["a"], ["b"]], index=[1, 2], columns=["value"]) msg = ( - rf"\"None of \[NumericIndex\(\[3\], dtype='{np.int_().dtype}'\)\] are " + rf"\"None of \[Index\(\[3\], dtype='{np.int_().dtype}'\)\] are " r"in the \[index\]\"" ) with pytest.raises(KeyError, match=msg): @@ -507,10 +507,7 @@ def test_loc_getitem_list_with_fail(self): s.loc[[2]] - msg = ( - f"\"None of [NumericIndex([3], dtype='{np.int_().dtype}')] " - 'are in the [index]"' - ) + msg = f"\"None of [Index([3], dtype='{np.int_().dtype}')] are in the [index]" with pytest.raises(KeyError, match=re.escape(msg)): s.loc[[3]] @@ -1201,7 +1198,7 @@ def test_loc_setitem_empty_append_raises(self): df = DataFrame(columns=["x", "y"]) df.index = df.index.astype(np.int64) msg = ( - rf"None of \[NumericIndex\(\[0, 1\], dtype='{np.int_().dtype}'\)\] " + rf"None of \[Index\(\[0, 1\], dtype='{np.int_().dtype}'\)\] " r"are in the \[index\]" ) with pytest.raises(KeyError, match=msg): diff --git a/pandas/tests/indexing/test_partial.py b/pandas/tests/indexing/test_partial.py index c26d57e7b97e3..3217c1cf7a2ac 100644 --- a/pandas/tests/indexing/test_partial.py +++ b/pandas/tests/indexing/test_partial.py @@ -403,7 +403,7 @@ def test_series_partial_set(self): # raises as nothing is in the index msg = ( - rf"\"None of \[NumericIndex\(\[3, 3, 3\], dtype='{np.int_().dtype}'\)\] " + rf"\"None of \[Index\(\[3, 3, 3\], dtype='{np.int_().dtype}'\)\] " r"are in the \[index\]\"" ) with pytest.raises(KeyError, match=msg): @@ -484,7 +484,7 @@ def test_series_partial_set_with_name(self): # raises as nothing is in the index msg = ( - rf"\"None of \[NumericIndex\(\[3, 3, 3\], dtype='{np.int_().dtype}', " + rf"\"None of \[Index\(\[3, 3, 3\], dtype='{np.int_().dtype}', " r"name='idx'\)\] are in the \[index\]\"" ) with pytest.raises(KeyError, match=msg): diff --git a/pandas/tests/resample/test_resample_api.py b/pandas/tests/resample/test_resample_api.py index 51a65d88d7b32..77b068aba765c 100644 --- a/pandas/tests/resample/test_resample_api.py +++ b/pandas/tests/resample/test_resample_api.py @@ -646,7 +646,7 @@ def test_selection_api_validation(): # non DatetimeIndex msg = ( "Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, " - "but got an instance of 'NumericIndex'" + "but got an instance of 'Index'" ) with pytest.raises(TypeError, match=msg): df.resample("2D", level="v") diff --git a/pandas/tests/util/test_assert_categorical_equal.py b/pandas/tests/util/test_assert_categorical_equal.py index 89b59ecb53413..d07bbcbc460a1 100644 --- a/pandas/tests/util/test_assert_categorical_equal.py +++ b/pandas/tests/util/test_assert_categorical_equal.py @@ -22,8 +22,8 @@ def test_categorical_equal_order_mismatch(check_category_order): msg = """Categorical\\.categories are different Categorical\\.categories values are different \\(100\\.0 %\\) -\\[left\\]: NumericIndex\\(\\[1, 2, 3, 4\\], dtype='int64'\\) -\\[right\\]: NumericIndex\\(\\[4, 3, 2, 1\\], dtype='int64'\\)""" +\\[left\\]: Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\) +\\[right\\]: Index\\(\\[4, 3, 2, 1\\], dtype='int64'\\)""" with pytest.raises(AssertionError, match=msg): tm.assert_categorical_equal(c1, c2, **kwargs) else: @@ -34,8 +34,8 @@ def test_categorical_equal_categories_mismatch(): msg = """Categorical\\.categories are different Categorical\\.categories values are different \\(25\\.0 %\\) -\\[left\\]: NumericIndex\\(\\[1, 2, 3, 4\\], dtype='int64'\\) -\\[right\\]: NumericIndex\\(\\[1, 2, 3, 5\\], dtype='int64'\\)""" +\\[left\\]: Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\) +\\[right\\]: Index\\(\\[1, 2, 3, 5\\], dtype='int64'\\)""" c1 = Categorical([1, 2, 3, 4]) c2 = Categorical([1, 2, 3, 5]) diff --git a/pandas/tests/util/test_assert_index_equal.py b/pandas/tests/util/test_assert_index_equal.py index 0052ea671a5b0..b7a68ab3960a1 100644 --- a/pandas/tests/util/test_assert_index_equal.py +++ b/pandas/tests/util/test_assert_index_equal.py @@ -17,7 +17,7 @@ def test_index_equal_levels_mismatch(): msg = """Index are different Index levels are different -\\[left\\]: 1, NumericIndex\\(\\[1, 2, 3\\], dtype='int64'\\) +\\[left\\]: 1, Index\\(\\[1, 2, 3\\], dtype='int64'\\) \\[right\\]: 2, MultiIndex\\(\\[\\('A', 1\\), \\('A', 2\\), \\('B', 3\\), @@ -35,8 +35,8 @@ def test_index_equal_values_mismatch(check_exact): msg = """MultiIndex level \\[1\\] are different MultiIndex level \\[1\\] values are different \\(25\\.0 %\\) -\\[left\\]: NumericIndex\\(\\[2, 2, 3, 4\\], dtype='int64'\\) -\\[right\\]: NumericIndex\\(\\[1, 2, 3, 4\\], dtype='int64'\\)""" +\\[left\\]: Index\\(\\[2, 2, 3, 4\\], dtype='int64'\\) +\\[right\\]: Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\)""" idx1 = MultiIndex.from_tuples([("A", 2), ("A", 2), ("B", 3), ("B", 4)]) idx2 = MultiIndex.from_tuples([("A", 1), ("A", 2), ("B", 3), ("B", 4)]) @@ -49,8 +49,8 @@ def test_index_equal_length_mismatch(check_exact): msg = """Index are different Index length are different -\\[left\\]: 3, NumericIndex\\(\\[1, 2, 3\\], dtype='int64'\\) -\\[right\\]: 4, NumericIndex\\(\\[1, 2, 3, 4\\], dtype='int64'\\)""" +\\[left\\]: 3, Index\\(\\[1, 2, 3\\], dtype='int64'\\) +\\[right\\]: 4, Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\)""" idx1 = Index([1, 2, 3]) idx2 = Index([1, 2, 3, 4]) @@ -85,7 +85,7 @@ def test_range_index_equal_class_mismatch(check_exact): msg = """Index are different Index classes are different -\\[left\\]: NumericIndex\\(\\[1, 2, 3\\], dtype='int64'\\) +\\[left\\]: Index\\(\\[1, 2, 3\\], dtype='int64'\\) \\[right\\]: """ idx1 = Index([1, 2, 3]) @@ -103,8 +103,8 @@ def test_index_equal_values_close(check_exact): msg = """Index are different Index values are different \\(33\\.33333 %\\) -\\[left\\]: NumericIndex\\(\\[1.0, 2.0, 3.0], dtype='float64'\\) -\\[right\\]: NumericIndex\\(\\[1.0, 2.0, 3.0000000001\\], dtype='float64'\\)""" +\\[left\\]: Index\\(\\[1.0, 2.0, 3.0], dtype='float64'\\) +\\[right\\]: Index\\(\\[1.0, 2.0, 3.0000000001\\], dtype='float64'\\)""" with pytest.raises(AssertionError, match=msg): tm.assert_index_equal(idx1, idx2, check_exact=check_exact) @@ -121,8 +121,8 @@ def test_index_equal_values_less_close(check_exact, rtol): msg = """Index are different Index values are different \\(33\\.33333 %\\) -\\[left\\]: NumericIndex\\(\\[1.0, 2.0, 3.0], dtype='float64'\\) -\\[right\\]: NumericIndex\\(\\[1.0, 2.0, 3.0001\\], dtype='float64'\\)""" +\\[left\\]: Index\\(\\[1.0, 2.0, 3.0], dtype='float64'\\) +\\[right\\]: Index\\(\\[1.0, 2.0, 3.0001\\], dtype='float64'\\)""" with pytest.raises(AssertionError, match=msg): tm.assert_index_equal(idx1, idx2, **kwargs) @@ -138,8 +138,8 @@ def test_index_equal_values_too_far(check_exact, rtol): msg = """Index are different Index values are different \\(33\\.33333 %\\) -\\[left\\]: NumericIndex\\(\\[1, 2, 3\\], dtype='int64'\\) -\\[right\\]: NumericIndex\\(\\[1, 2, 4\\], dtype='int64'\\)""" +\\[left\\]: Index\\(\\[1, 2, 3\\], dtype='int64'\\) +\\[right\\]: Index\\(\\[1, 2, 4\\], dtype='int64'\\)""" with pytest.raises(AssertionError, match=msg): tm.assert_index_equal(idx1, idx2, **kwargs) @@ -153,8 +153,8 @@ def test_index_equal_value_oder_mismatch(check_exact, rtol, check_order): msg = """Index are different Index values are different \\(66\\.66667 %\\) -\\[left\\]: NumericIndex\\(\\[1, 2, 3\\], dtype='int64'\\) -\\[right\\]: NumericIndex\\(\\[3, 2, 1\\], dtype='int64'\\)""" +\\[left\\]: Index\\(\\[1, 2, 3\\], dtype='int64'\\) +\\[right\\]: Index\\(\\[3, 2, 1\\], dtype='int64'\\)""" if check_order: with pytest.raises(AssertionError, match=msg): @@ -175,8 +175,8 @@ def test_index_equal_level_values_mismatch(check_exact, rtol): msg = """MultiIndex level \\[1\\] are different MultiIndex level \\[1\\] values are different \\(25\\.0 %\\) -\\[left\\]: NumericIndex\\(\\[2, 2, 3, 4\\], dtype='int64'\\) -\\[right\\]: NumericIndex\\(\\[1, 2, 3, 4\\], dtype='int64'\\)""" +\\[left\\]: Index\\(\\[2, 2, 3, 4\\], dtype='int64'\\) +\\[right\\]: Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\)""" with pytest.raises(AssertionError, match=msg): tm.assert_index_equal(idx1, idx2, **kwargs) @@ -232,7 +232,7 @@ def test_index_equal_range_categories(check_categorical, exact): Index classes are different \\[left\\]: RangeIndex\\(start=0, stop=10, step=1\\) -\\[right\\]: NumericIndex\\(\\[0, 1, 2, 3, 4, 5, 6, 7, 8, 9\\], dtype='int64'\\)""" +\\[right\\]: Index\\(\\[0, 1, 2, 3, 4, 5, 6, 7, 8, 9\\], dtype='int64'\\)""" rcat = CategoricalIndex(RangeIndex(10)) icat = CategoricalIndex(list(range(10))) From c37b80539150f04eacecbda77b4247f0a43ddb58 Mon Sep 17 00:00:00 2001 From: Terji Petersen Date: Mon, 30 Jan 2023 22:18:16 +0000 Subject: [PATCH 2/3] fix error --- pandas/tests/resample/test_resample_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/resample/test_resample_api.py b/pandas/tests/resample/test_resample_api.py index 77b068aba765c..51a65d88d7b32 100644 --- a/pandas/tests/resample/test_resample_api.py +++ b/pandas/tests/resample/test_resample_api.py @@ -646,7 +646,7 @@ def test_selection_api_validation(): # non DatetimeIndex msg = ( "Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, " - "but got an instance of 'Index'" + "but got an instance of 'NumericIndex'" ) with pytest.raises(TypeError, match=msg): df.resample("2D", level="v") From 46b61578e86a3a9fc7d83940535d8af96270732c Mon Sep 17 00:00:00 2001 From: Terji Petersen Date: Tue, 31 Jan 2023 01:16:11 +0000 Subject: [PATCH 3/3] fix error II --- pandas/io/formats/info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/io/formats/info.py b/pandas/io/formats/info.py index d826c0a148ebe..9a93724ca8f37 100644 --- a/pandas/io/formats/info.py +++ b/pandas/io/formats/info.py @@ -165,7 +165,7 @@ >>> s = pd.Series(text_values, index=int_values) >>> s.info() - Index: 5 entries, 1 to 5 + NumericIndex: 5 entries, 1 to 5 Series name: None Non-Null Count Dtype -------------- ----- @@ -177,7 +177,7 @@ >>> s.info(verbose=False) - Index: 5 entries, 1 to 5 + NumericIndex: 5 entries, 1 to 5 dtypes: object(1) memory usage: 80.0+ bytes