Skip to content

Commit 08f02be

Browse files
rmihaeljreback
authored andcommitted
Make DatetimeIndex iterator pickleable by dill (#18848)
Currently, dill (https://github.com/uqfoundation/dill) cannot pickle iterators over DatetimeIndex because they are generators. This simple change removes that limitation.
1 parent 554472f commit 08f02be

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pandas/core/indexes/datetimes.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1251,8 +1251,7 @@ def __iter__(self):
12511251
converted = libts.ints_to_pydatetime(data[start_i:end_i],
12521252
tz=self.tz, freq=self.freq,
12531253
box="timestamp")
1254-
for v in converted:
1255-
yield v
1254+
return iter(converted)
12561255

12571256
def _wrap_union_result(self, other, result):
12581257
name = self.name if self.name == other.name else None

0 commit comments

Comments
 (0)