Skip to content

Commit 966d1e2

Browse files
committed
STY: Add strict=True in zip() in to_dict.py
1 parent b20d6ab commit 966d1e2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pandas/core/methods/to_dict.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def to_dict(
198198
if i in object_dtype_indices_as_set
199199
else list(map(maybe_box_native, v.to_numpy())),
200200
)
201-
for i, (box_na_value, (k, v)) in enumerate(zip(box_na_values, df.items()))
201+
for i, (box_na_value, (k, v)) in enumerate(zip(box_na_values, df.items(), strict=True))
202202
)
203203

204204
elif orient == "split":
@@ -235,12 +235,12 @@ def to_dict(
235235
columns = df.columns.tolist()
236236
if are_all_object_dtype_cols:
237237
return [
238-
into_c(zip(columns, map(maybe_box_native, row)))
238+
into_c(zip(columns, map(maybe_box_native, row), strict=True))
239239
for row in df.itertuples(index=False, name=None)
240240
]
241241
else:
242242
data = [
243-
into_c(zip(columns, t)) for t in df.itertuples(index=False, name=None)
243+
into_c(zip(columns, t, strict=True)) for t in df.itertuples(index=False, name=None)
244244
]
245245
if box_native_indices:
246246
object_dtype_indices_as_set = set(box_native_indices)
@@ -260,7 +260,7 @@ def to_dict(
260260
columns = df.columns.tolist()
261261
if are_all_object_dtype_cols:
262262
return into_c(
263-
(t[0], dict(zip(df.columns, map(maybe_box_native, t[1:]))))
263+
(t[0], dict(zip(df.columns, map(maybe_box_native, t[1:]), strict=True)))
264264
for t in df.itertuples(name=None)
265265
)
266266
elif box_native_indices:
@@ -272,14 +272,14 @@ def to_dict(
272272
column: maybe_box_native(v)
273273
if i in object_dtype_indices_as_set
274274
else v
275-
for i, (column, v) in enumerate(zip(columns, t[1:]))
275+
for i, (column, v) in enumerate(zip(columns, t[1:], strict=True))
276276
},
277277
)
278278
for t in df.itertuples(name=None)
279279
)
280280
else:
281281
return into_c(
282-
(t[0], dict(zip(columns, t[1:]))) for t in df.itertuples(name=None)
282+
(t[0], dict(zip(columns, t[1:], strict=True))) for t in df.itertuples(name=None)
283283
)
284284

285285
else:

0 commit comments

Comments
 (0)