We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b372ac4 commit 59d6aa1Copy full SHA for 59d6aa1
pandas/tests/series/indexing/test_indexing.py
@@ -907,3 +907,18 @@ def test_head_tail(test_data):
907
assert_series_equal(test_data.series.head(0), test_data.series[0:0])
908
assert_series_equal(test_data.series.tail(), test_data.series[-5:])
909
assert_series_equal(test_data.series.tail(0), test_data.series[0:0])
910
+
911
912
+def test_index_map():
913
+ # see GH20990
914
+ count = 6
915
+ index = pd.date_range("2018-01-01", periods=count, freq="M")
916
917
+ a = Series(np.arange(count), index=index)
918
+ a.index.name = "name"
919
920
+ b = a.copy()
921
+ try:
922
+ b.index = a.index.map(lambda x: (x.year, x.month))
923
+ except ValueError:
924
+ pytest.fail("Unexpected ValueError")
0 commit comments