-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
ENH: Implemented lazy iteration #20796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
aa08a6d
ae026b2
b253674
6a65cbc
080f0bd
4bc7a78
ff3174a
854ac01
49248d2
2780c6f
05ef2f8
766ba8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
import pandas._libs.lib as lib | ||
import pandas.compat as compat | ||
from pandas.compat import PYPY, OrderedDict, builtins | ||
from pandas.compat import PYPY, OrderedDict, builtins, map, range | ||
from pandas.compat.numpy import function as nv | ||
from pandas.errors import AbstractMethodError | ||
from pandas.util._decorators import Appender, Substitution, cache_readonly | ||
|
@@ -1072,7 +1072,13 @@ def __iter__(self): | |
(for str, int, float) or a pandas scalar | ||
(for Timestamp/Timedelta/Interval/Period) | ||
""" | ||
return iter(self.tolist()) | ||
# We are explicity making element iterators. | ||
if is_datetimelike(self._values): | ||
return map(com.maybe_box_datetimelike, self._values) | ||
elif is_extension_array_dtype(self._values): | ||
return iter(self._values) | ||
else: | ||
return map(self._values.item, range(self._values.size)) | ||
mitar marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha, I am looking at this now and I do not get anymore why we are mapping over a range here? We should map over values of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, here's your commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I know. |
||
|
||
@cache_readonly | ||
def hasnans(self): | ||
|
Uh oh!
There was an error while loading. Please reload this page.