Skip to content

Fix type annotations in pandas.core.indexes.datetimes #26404

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 15 commits into from
May 24, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix the function signature of map to be consistent across different c…
…lasses
  • Loading branch information
vaibhavhrt committed May 20, 2019
commit 247dd31e617eb12201656790097c53b87e6bcdf3
6 changes: 3 additions & 3 deletions pandas/core/indexes/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ def __contains__(self, key):

# Try to run function on index first, and then on elements of index
# Especially important for group-by functionality
def map(self, f):
def map(self, mapper, na_action=None):
try:
result = f(self)
result = mapper(self)

# Try to use this result if we can
if isinstance(result, np.ndarray):
Expand All @@ -232,7 +232,7 @@ def map(self, f):
raise TypeError('The map function must return an Index object')
return result
except Exception:
return self.astype(object).map(f)
return self.astype(object).map(mapper)

def sort_values(self, return_indexer=False, ascending=True):
"""
Expand Down