agate.csv_py3

The classes and functions in this module serve as a replacement for Python 3’s core csv module on Python 3. These versions add several minor features.

If you are using Python 3, these classes and functions will automatically be made available as part of the agate import. This means you can access them by:

from agate import DictReader

Or, if you want to use them as a drop-in replacement for csv:

import agate as csv
class agate.csv_py3.Reader(f, field_size_limit=None, line_numbers=False, header=True, **kwargs)

Bases: six.Iterator

A wrapper around Python 3’s builtin csv.reader().

dialect
line_num
class agate.csv_py3.Writer(f, line_numbers=False, **kwargs)

Bases: object

A wrapper around Python 3’s builtin csv.writer().

writerow(row)
writerows(rows)
class agate.csv_py3.DictReader(f, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds)

Bases: csv.DictReader

A wrapper around Python 3’s builtin csv.DictReader.

class agate.csv_py3.DictWriter(f, fieldnames, line_numbers=False, **kwargs)

Bases: csv.DictWriter

A wrapper around Python 3’s builtin csv.DictWriter.

writerow(row)
writerows(rows)
class agate.csv_py3.Sniffer

A functinonal wrapper of csv.Sniffer().

sniff(sample)

A functional version of csv.Sniffer().sniff, that extends the list of possible delimiters to include some seen in the wild.

agate.csv_py3.reader(*args, **kwargs)

A drop-in replacement for Python’s csv.reader() that leverages Reader.

agate.csv_py3.writer(*args, **kwargs)

A drop-in replacement for Python’s csv.writer() that leverages Writer.