Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

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
CLN: Checking is_dict_like instead of is abc.Mapping
  • Loading branch information
ohad83 authored and jreback committed Jan 1, 2020
commit 49637e17dcc5ba3ffbc3a0962c8801f56bd6e3fa
5 changes: 3 additions & 2 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Base and utility classes for pandas objects.
"""
import builtins
from collections import OrderedDict, abc
from collections import OrderedDict
import textwrap
from typing import Dict, FrozenSet, List, Optional

Expand All @@ -21,6 +21,7 @@
is_datetime64_ns_dtype,
is_datetime64tz_dtype,
is_extension_array_dtype,
is_dict_like,
is_list_like,
is_object_dtype,
is_scalar,
Expand Down Expand Up @@ -1108,7 +1109,7 @@ def _map_values(self, mapper, na_action=None):
# we can fastpath dict/Series to an efficient map
# as we know that we are not going to have to yield
# python types
if isinstance(mapper, abc.Mapping):
if is_dict_like(mapper):
if isinstance(mapper, dict) and hasattr(mapper, "__missing__"):
# If a dictionary subclass defines a default value method,
# convert mapper to a lookup function (GH #15999).
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Data structure for 1-dimensional cross-sectional and time series data
"""
from collections import abc
from io import StringIO
from shutil import get_terminal_size
from textwrap import dedent
Expand Down Expand Up @@ -252,7 +251,7 @@ def __init__(
else:
data = data.reindex(index, copy=copy)
data = data._data
elif isinstance(data, abc.Mapping):
elif is_dict_like(data):
data, index = self._init_dict(data, index, dtype)
dtype = None
copy = False
Expand Down