Metadata-Version: 1.1
Name: encoded_csv
Version: 0.2.a2
Summary: Read a CSV file using arbitrary character encodings.
Home-page: http://change.me
Author: Tom Elliott
Author-email: tom.elliott@nyu.edu
License: LICENSE.txt
Description: 
        encoded_csv
        ===========
        
        Could that CSV file be encoded in something other than ASCII? No problem.
        
        This package provides support for reading CSV files that use arbitrary text encodings. It is built on top of Python's standard `csv <https://docs.python.org/3/library/csv.html>`_ and `codecs <https://docs.python.org/3.6/library/codecs.html>`_ packages, and it uses `Daniel Blanchard's ``chardet`` universal encoding detector <https://pypi.python.org/pypi/chardet>`_ to guess the encoding for a file, if necessary. 
        
        Note that ``utf-8-sig`` (UTF-8 with leading `Byte Order Mark <http://unicode.org/faq/utf_bom.html#BOM>`_\ ) is supported. This format is used by recent versions of Microsoft Excel when the user selects "Save As ..." and chooses the "CSV UTF-8."
        
        using it
        --------
        
        There's just one function: ``get_csv()``\ , as follows:
        
        .. code-block:: python
        
           encoded_csv.get_csv(csv_file, skip_lines=0, encoding='', dialect='', fieldnames=[], sample_lines=100)
        
        Code in the ``tests/`` directory provides usage examples. The function returns a tuple, in which the first item is a list of the field names. The second item is a list of ordered dictionaries, each containing the data read from a given line of the CSV file.
        
        The first row (after discarding any header lines) is assumed to contain column names.
        
        Keyword arguments:
        
        
        * ``csv_file`` -- path to CSV file to open
        * ``skip_header_lines`` -- (optional) number of lines to discard in the assumption that they constitute a file header of some sort (default is to skip no lines)
        * ``encoding`` -- (optional) specifies the encoding which is to be used for the file; `the standard python ``codecs`` module <https://docs.python.org/3.6/library/codecs.html>`_ is used, so any of `the standard encodings <https://docs.python.org/3.6/library/codecs.html#standard-encodings>`_ may be specified; default behavior is to attempt best guess using ``chardet``\ )
        * ``dialect`` -- (optional) a set of parameters specific to a particular CSV dialect; `the standard python ``csv`` module <https://docs.python.org/3/library/csv.html>`_ is used, so `the standard, predefined ``dialect`` values or formatting parameters <https://docs.python.org/3/library/csv.html#csv-fmt-params>`_ must be used; default behavior is to attempt best guess using ``csv.Sniffer``.
        * ``fieldnames`` -- (optional) is used to force the `csv.DictReader <https://docs.python.org/3/library/csv.html#csv.DictReader>`_ to use a particular set of fieldnames. 
        * ``sample_lines`` -- (optional) integer used to prepare the sample given to ``csv.Sniffer()`` when attempting to detect the CSV dialect in use; default is 100 lines or the entire file, whichever is fewer.
        
        etc.
        ----
        
        Bug reports and feature requests are welcome, but really I'd prefer pull requests. 
        
Keywords: scripting,csv,i18n,encoding
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
