Skip to content

Commit c6956af

Browse files
committed
Changed the way of generating the tuple
1 parent b5e5b28 commit c6956af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/core/series.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,12 @@ def _init_dict(self, data, index=None, dtype=None):
355355
# raises KeyError), so we iterate the entire dict, and align
356356
if data:
357357
# GH:34717
358-
# Using the below way to generate tuple of keys and values increasing the performance by 50%, instead of zip
358+
# Using the below way to generate tuple of keys and values
359+
# increasing the performance by 50%, instead of zip
359360
keys = tuple(data.keys())
360-
values = tuple([data[key] for key in keys])
361+
values = (
362+
*[data[key] for key in keys],
363+
) # Generating tuple of values- faster way
361364

362365
elif index is not None:
363366
# fastpath for Series(data=None). Just use broadcasting a scalar

0 commit comments

Comments
 (0)