1111labeling information
1212"""
1313import collections
14- from collections import OrderedDict
14+ from collections import OrderedDict , abc
1515import functools
1616import itertools
1717import sys
3333 validate_axis_style_args )
3434
3535from pandas import compat
36- from pandas .compat import (
37- PY36 , Iterator , StringIO , lmap , lzip , raise_with_traceback )
36+ from pandas .compat import PY36 , StringIO , lmap , lzip , raise_with_traceback
3837from pandas .compat .numpy import function as nv
3938from pandas .core .dtypes .cast import (
4039 maybe_upcast ,
@@ -426,9 +425,9 @@ def __init__(self, data=None, index=None, columns=None, dtype=None,
426425 copy = copy )
427426
428427 # For data is list-like, or Iterable (will consume into list)
429- elif (isinstance (data , compat .Iterable ) and
428+ elif (isinstance (data , abc .Iterable ) and
430429 not isinstance (data , (str , bytes ))):
431- if not isinstance (data , compat .Sequence ):
430+ if not isinstance (data , abc .Sequence ):
432431 data = list (data )
433432 if len (data ) > 0 :
434433 if is_list_like (data [0 ]) and getattr (data [0 ], 'ndim' , 1 ) == 1 :
@@ -1203,7 +1202,7 @@ def to_dict(self, orient='dict', into=dict):
12031202 indicates `split`.
12041203
12051204 into : class, default dict
1206- The collections.Mapping subclass used for all Mappings
1205+ The collections.abc. Mapping subclass used for all Mappings
12071206 in the return value. Can be the actual class or an empty
12081207 instance of the mapping type you want. If you want a
12091208 collections.defaultdict, you must pass it initialized.
@@ -1212,8 +1211,8 @@ def to_dict(self, orient='dict', into=dict):
12121211
12131212 Returns
12141213 -------
1215- dict, list or collections.Mapping
1216- Return a collections.Mapping object representing the DataFrame.
1214+ dict, list or collections.abc. Mapping
1215+ Return a collections.abc. Mapping object representing the DataFrame.
12171216 The resulting transformation depends on the `orient` parameter.
12181217
12191218 See Also
@@ -4080,7 +4079,7 @@ def set_index(self, keys, drop=True, append=False, inplace=False,
40804079 the same length as the calling DataFrame, or a list containing an
40814080 arbitrary combination of column keys and arrays. Here, "array"
40824081 encompasses :class:`Series`, :class:`Index`, ``np.ndarray``, and
4083- instances of :class:`abc.Iterator`.
4082+ instances of :class:`~collections. abc.Iterator`.
40844083 drop : bool, default True
40854084 Delete columns to be used as the new index.
40864085 append : bool, default False
@@ -4166,7 +4165,7 @@ def set_index(self, keys, drop=True, append=False, inplace=False,
41664165 missing = []
41674166 for col in keys :
41684167 if isinstance (col , (ABCIndexClass , ABCSeries , np .ndarray ,
4169- list , Iterator )):
4168+ list , abc . Iterator )):
41704169 # arrays are fine as long as they are one-dimensional
41714170 # iterators get converted to list below
41724171 if getattr (col , 'ndim' , 1 ) != 1 :
@@ -4213,7 +4212,7 @@ def set_index(self, keys, drop=True, append=False, inplace=False,
42134212 elif isinstance (col , (list , np .ndarray )):
42144213 arrays .append (col )
42154214 names .append (None )
4216- elif isinstance (col , Iterator ):
4215+ elif isinstance (col , abc . Iterator ):
42174216 arrays .append (list (col ))
42184217 names .append (None )
42194218 # from here, col can only be a column label
0 commit comments