Skip to content

PERF: Should 'iter[x]'s be generators? #11338

Closed
@max-sixty

Description

@max-sixty

Looking here: https://github.com/pydata/pandas/pull/11325/files#diff-1e79abbbdd150d4771b91ea60a4e1cc7R686, #11325

...currently itertuples is building a new full objects in memory and then creating an iterator over those objects. Because it's building a new tuple for each row, these aren't views (I think). Should these instead yield a tuple / row / item on each call, using a generator?

The upside is that you don't need to rebuild the object in memory at once. The downside is that it is dependent on the underlying data (as though it were a view).

(and possible there is something going on that I don't understand, either with pandas or generators...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    PerformanceMemory or execution speed performanceReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions