Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 1.5 KB

csvio.fieldprocessor.rst

File metadata and controls

37 lines (28 loc) · 1.5 KB

Field Processor

A Field Processor may be used to transform the values in a row represented by a dictionary that maps column->value pairs.

In csvio a CSV file is represented by a list of dictionaries that is populated in the rows attribute of the :py~csvio.CSVReader or :py~csvio.CSVWriter Classes.

Once instantiated, a Field Processor Object can be used by itself to process an arbitrary dictionary that represents a row or can be passed to the constructors of :py~csvio.CSVReader or :py~csvio.CSVWriter.

In the case where a Field Processor Object is passed to the constructor of :py~csvio.CSVReader, it is applied to the rows of the :py~csvio.CSVReader as soon as they are read from the CSV file. See example code <csvreader_fp_usage> for further details.

Similarly, in the case where a Field Processor Object is passed to the constructor of :py~csvio.CSVWriter, it is applied to the rows of the :py~csvio.CSVWriter as soon as they are added for writing to the output CSV using its :py~csvio.CSVWriter.add_rows method. See example code <csvwriter_fp_usage> for further details.

Standalone Example Usage

csvio.processors.field_processor.FieldProcessor