Skip to content

Commit ce6128a

Browse files
committed
changes
1 parent 8b986d6 commit ce6128a

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

pandas/core/internals/construction.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,13 @@ def init_dict(data, index, columns, dtype=None):
195195
arrays.loc[missing] = [val] * missing.sum()
196196

197197
else:
198-
data = OrderedDict((col_name, com.maybe_itarable_to_list(col))
199-
for col_name, col in data.items())
200198
keys = com.dict_keys_to_ordered_list(data)
201199
columns = data_names = Index(keys)
200+
arrays = (com.maybe_itarable_to_list(data[k]) for k in keys)
202201
# GH#24096 need copy to be deep for datetime64tz case
203202
# TODO: See if we can avoid these copies
204-
arrays = [data[k] if not is_datetime64tz_dtype(data[k]) else
205-
data[k].copy(deep=True) for k in keys]
203+
arrays = [arr if not is_datetime64tz_dtype(arr) else
204+
arr.copy(deep=True) for arr in arrays]
206205
return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
207206

208207

pandas/core/series.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Data structure for 1-dimensional cross-sectional and time series data
33
"""
4-
from collections import OrderedDict, abc
4+
from collections import OrderedDict
55
from io import StringIO
66
from shutil import get_terminal_size
77
from textwrap import dedent
@@ -219,14 +219,11 @@ def __init__(self, data=None, index=None, dtype=None, name=None,
219219
elif isinstance(data, (set, frozenset)):
220220
raise TypeError("{0!r} type is unordered"
221221
"".format(data.__class__.__name__))
222-
elif (isinstance(data, abc.Iterable) and
223-
not isinstance(data, abc.Sized)):
224-
data = com.maybe_itarable_to_list(data)
225222
elif isinstance(data, ABCSparseArray):
226223
# handle sparse passed here (and force conversion)
227224
data = data.to_dense()
228225
else:
229-
pass
226+
data = com.maybe_itarable_to_list(data)
230227

231228
if index is None:
232229
if not is_list_like(data):

0 commit comments

Comments
 (0)