Skip to content

Commit 3ff220c

Browse files
committed
Fix issues from merge
1 parent 6a34b5f commit 3ff220c

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Diff for: pandas/core/base.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
is_object_dtype,
1313
is_list_like,
1414
is_scalar,
15-
is_datetimelike)
15+
is_datetimelike,
16+
is_extension_type)
1617

1718
from pandas.util._validators import validate_bool_kwarg
1819

@@ -854,7 +855,7 @@ def _map_values(self, values, arg, na_action=None):
854855
855856
Returns
856857
-------
857-
applied : {Index, MultiIndex}, inferred
858+
applied : Union[Index, MultiIndex], inferred
858859
The output of the mapping function applied to the index.
859860
If the function returns a tuple with more than one element
860861
a MultiIndex will be returned.
@@ -868,7 +869,7 @@ def _map_values(self, values, arg, na_action=None):
868869
if na_action == 'ignore':
869870
def map_f(values, f):
870871
return lib.map_infer_mask(values, f,
871-
isnull(values).view(np.uint8))
872+
isna(values).view(np.uint8))
872873
else:
873874
map_f = lib.map_infer
874875

Diff for: pandas/core/indexes/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2892,7 +2892,7 @@ def map(self, arg, na_action=None):
28922892
28932893
Returns
28942894
-------
2895-
applied : {Index, MultiIndex}, inferred
2895+
applied : Union[Index, MultiIndex], inferred
28962896
The output of the mapping function applied to the index.
28972897
If the function returns a tuple with more than one element
28982898
a MultiIndex will be returned.
@@ -2914,7 +2914,7 @@ def map(self, arg, na_action=None):
29142914
names=names)
29152915

29162916
attributes['copy'] = False
2917-
return Index(new_values, **attributes)
2917+
return self._constructor(new_values, **attributes)
29182918

29192919
def isin(self, values, level=None):
29202920
"""

Diff for: pandas/tests/indexes/test_base.py

+3
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ def test_map_with_dict_and_series(self):
842842
if name == 'catIndex':
843843
# Tested in test_categorical
844844
continue
845+
elif name == 'repeats':
846+
# Cannot map duplicated index
847+
continue
845848

846849
cur_index = self.indices[name]
847850
expected = Index(np.arange(len(cur_index), 0, -1))

0 commit comments

Comments
 (0)