11
11
labeling information
12
12
"""
13
13
import collections
14
- from collections import OrderedDict
14
+ from collections import OrderedDict , abc
15
15
import functools
16
16
import itertools
17
17
import sys
33
33
validate_axis_style_args )
34
34
35
35
from 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
38
37
from pandas .compat .numpy import function as nv
39
38
from pandas .core .dtypes .cast import (
40
39
maybe_upcast ,
@@ -426,9 +425,9 @@ def __init__(self, data=None, index=None, columns=None, dtype=None,
426
425
copy = copy )
427
426
428
427
# 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
430
429
not isinstance (data , (str , bytes ))):
431
- if not isinstance (data , compat .Sequence ):
430
+ if not isinstance (data , abc .Sequence ):
432
431
data = list (data )
433
432
if len (data ) > 0 :
434
433
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):
1203
1202
indicates `split`.
1204
1203
1205
1204
into : class, default dict
1206
- The collections.Mapping subclass used for all Mappings
1205
+ The collections.abc. Mapping subclass used for all Mappings
1207
1206
in the return value. Can be the actual class or an empty
1208
1207
instance of the mapping type you want. If you want a
1209
1208
collections.defaultdict, you must pass it initialized.
@@ -1212,8 +1211,8 @@ def to_dict(self, orient='dict', into=dict):
1212
1211
1213
1212
Returns
1214
1213
-------
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.
1217
1216
The resulting transformation depends on the `orient` parameter.
1218
1217
1219
1218
See Also
@@ -4080,7 +4079,7 @@ def set_index(self, keys, drop=True, append=False, inplace=False,
4080
4079
the same length as the calling DataFrame, or a list containing an
4081
4080
arbitrary combination of column keys and arrays. Here, "array"
4082
4081
encompasses :class:`Series`, :class:`Index`, ``np.ndarray``, and
4083
- instances of :class:`abc.Iterator`.
4082
+ instances of :class:`~collections. abc.Iterator`.
4084
4083
drop : bool, default True
4085
4084
Delete columns to be used as the new index.
4086
4085
append : bool, default False
@@ -4166,7 +4165,7 @@ def set_index(self, keys, drop=True, append=False, inplace=False,
4166
4165
missing = []
4167
4166
for col in keys :
4168
4167
if isinstance (col , (ABCIndexClass , ABCSeries , np .ndarray ,
4169
- list , Iterator )):
4168
+ list , abc . Iterator )):
4170
4169
# arrays are fine as long as they are one-dimensional
4171
4170
# iterators get converted to list below
4172
4171
if getattr (col , 'ndim' , 1 ) != 1 :
@@ -4213,7 +4212,7 @@ def set_index(self, keys, drop=True, append=False, inplace=False,
4213
4212
elif isinstance (col , (list , np .ndarray )):
4214
4213
arrays .append (col )
4215
4214
names .append (None )
4216
- elif isinstance (col , Iterator ):
4215
+ elif isinstance (col , abc . Iterator ):
4217
4216
arrays .append (list (col ))
4218
4217
names .append (None )
4219
4218
# from here, col can only be a column label
0 commit comments