jdunck / python-unicodecsv

Python2's stdlib csv module is nice, but it doesn't support unicode. This module is a drop-in replacement which *does*. If you prefer python 3's semantics but need support in py2, you probably want https://github.com/ryanhiebert/backports.csv
Other
594 stars 87 forks source link

Only call isinstance(value, float) if needed. #47

Closed kengruven closed 9 years ago

kengruven commented 9 years ago

The built-in csv.reader only yields numbers if the dialect specifies csv.QUOTE_NONNUMERIC. By default (dialect=excel), this isn’t enabled, and avoiding this isinstance() call makes unicodecsv parsing about 2x as fast for large files.

jdunck commented 9 years ago

Thanks for this tuning - I knew unicodecsv was slower than the c alternatives, but not that folks were using it on such large files that these sorts of tweaks could be material.