fastcsv is a module that treats CSV files. Its reading/writing speed is faster than standard csv module.
Source: | https://github.com/draftcode/fastcsv |
---|---|
PyPI: | https://pypi.python.org/pypi/fastcsv |
(Average of 10 times trial. Measured on Python 2.7.3, Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz, tmpfs)
csv module cannot treat unicode string, so if you want to properly treat CSV files that are encoded non-ascii encoding you have to wrap it to re-code the file, which is described in its documentation. For example, if you want to read cp932 encoded CSV file, you have to re-code like this:
csvwrapper will do this re-coding for you. But its I/O speed is about 10 times decreased.
To overcome this speed drawback, csv module has been forked and changed to use TextIO, which is open-sourced as unicode_csv. unicode_csv uses same algorithm with csv, and this algorithm can be improved, and the improved version is fastcsv.