MKuranowski / aiocsv

Python: Asynchronous CSV reading/writing
https://pypi.org/project/aiocsv/
MIT License
67 stars 9 forks source link

Added rowfilters and colfilters to AsyncDictReader #12

Closed acortad closed 1 year ago

acortad commented 1 year ago

Hello,

Added the possibility of filtering rows and/or columns by one or more criteria, while reading each single row.

This can result in increased memory efficiency when e.g. streaming an online CSV and you only want to keep specific rows and/or columns.

Best

MKuranowski commented 1 year ago

This is not something that the built-in CSV module implements. aiocsv only aims for feature parity (not superiority) with csv. Sorry for wasting your work, I have mentioned this in a previous PR, and I should clarify this in readme or sth.

Also, just how this improves efficiency? This code still does dict(zip(self.fieldnames, cells)) for every row in the input file. I don't see how this would be better than an async-filter over the row iterator.